System.NotSupportedException: This method explicitly uses CAS policy, which has been obsoleted by the .Net Framework - by Sheng Jiang 蒋晟

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 509613 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 11/10/2009 12:22:15 PM
Access Restriction Public

Description

Visual Studio 2010 & .Net Framework 4 binaries need to turn on NetFx40_LegacySecurityPolicy in config file for .Net 4.0 code that references assemblies that explicitly uses the CAS policy.

A related discussion about the Windows SDK tool lc.exe is at
http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/a3c897c6-e816-460b-b74d-b683ea033a2d
Sign in to post a comment.
Posted by Mladen Mihajlovic on 7/12/2010 at 2:45 AM
We had this issue opening forms using DevExpress 8.3.4 controls. The thing is that our project is targeted to use the .NET framework ver 3 and not 4 but the error still came up when opening the forms. I added the NetFx40_LegacySecurityPolicy to my machine.config file for the ver 4 framework and it works now, but I still think it should not be doing this.
Posted by Microsoft on 11/19/2009 at 11:31 AM
Hi Sheng,

Thank you for reporting this issue to us - I was able to get more information around this issue from your forum post [http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/a3c897c6-e816-460b-b74d-b683ea033a2d]. The issue here is that your Winforms project (mentioned in the forum post) utilizes controls that use Code Access Security (CAS) Policy APIs. These APIs have been deprecated as runtime-wide CAS Policy is no longer enforced in .NET Framework 4.

Our SDK tools don't use the CAS policy APIs themselves, so it wouldn't be appropriate for the tools themselves to set the compatibility flag (which is first and foremost a migration mechanism). Therefore, the real solution is for those controls to move off of their dependency on CAS policy; I've already sent mail to the control owners regarding this.

Thank you,
Andrew Dai
Microsoft Corporation - CLR Security
Posted by Microsoft on 11/13/2009 at 4:32 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Posted by Microsoft on 11/11/2009 at 3:17 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)