[ACCEPTED]-System.MethodAccessException: Attempt by security transparent method to access security critical method fails on all applications-visual-web-developer-2010
I experienced this issue today. As far 9 as I understand it, the problem is that 8 .NET 4.0 assemblies now default to security critical. It's 7 not possible for security transparent code 6 to call into security critical code.
The 5 solution in my case was related to having 4 AllowPartiallyTrustedCallersAttribute
defined on only a few of the assemblies 3 in my application. I had to either remove 2 this attribute from all assemblies, or add 1 it to all of them.
You may need to add the following to your 2 AssemblyInfo.cs file so that the involved 1 assemblies are the same.
[assembly: SecurityTransparent()]
Appreciate I'm extremely late to the party 4 here but in VS2013 and suffering the same 3 issue with a .NET 4.5.1 ClickOnce project, I 2 fixed this issue by:
- Opening the Project Properties of the ClickOnce project in question
- Opening the Security tab
- Changing the trust settings to "This is a partial trust application"
- Changing the trust settings back to "This is a full trust application"
Hope this helps someone 1 else!
Apparently, one potential workaround which 22 at least made it possible for me to launch 21 applications in Visual Web Developer was 20 this:
Remove the targetFramework="4.0" attribute from the element 19 which is located within the element.
If 18 it is a Silverlight application Right 17 click the ApplicationName.Web header select 16 properties, then change the target framework 15 to 3.5. If it is an asp.net application 14 right click the top project header and select 13 properties and then set the target framework 12 to 3.5.
All this suggests to me their is 11 a problem with my .Net 4.0 framework installation. But 10 as I have installed and uninstalled and 9 then installed the .Net 4.0 framework at 8 least twice, this is the only option I can 7 think of at this point. If someone provides 6 me a better response/More permanent solution 5 that works for me I'll mark that as the 4 answer. In the meantime I will try launching 3 the "install other frameworks" and reinstalling 2 both the .Net 4.0 targeting pack and .Net 1 4.0 Runtime once more to see if it works.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.