DkAngelito
DkAngelito

Reputation: 1187

Visual studio security problems when running projects - Trust levels

I had been working fine on my previous machine, but i bought a new one and I installed everything I needed there (Win 7 x64 Enterprise, VS 2010 Proffesional SP1) and I downloaded several projects from my CVSNT repository.

Now, in the new PC, I'm having a lot of security troubles running the applications. The last one says something like

Attempt by security transparent method 'Namespace.class.method()' to access security critical method 'Namespace.class.method()' failed.

Assembly 'Assembly' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.

Before that never happened before, and now several trust issues are bothering all the time.

I'm running VS as administrator and dont have the UAC enabled.

Any suggestion of how to solve this issues and why are all my projects having Trust problems?

Upvotes: 1

Views: 1122

Answers (1)

akton
akton

Reputation: 14386

Is this the first time the project has been compiled or used with .Net 4.0? If so, there have been changes to the security model in .Net 4.0. where Microsoft has tried to simplify the Code Access Security (CAS) model. Desktop applications and other non-framework code now have some restrictions by default and those restrictions are enforced at runtime rather than compile time or assembly load time.

To fix it, you may need to add [assembly:SecurityRules(SecurityRuleSet.Level1)] to your AssemblyInfo.cs file. See They are described in detail at http://msdn.microsoft.com/en-us/library/dd233103(v=VS.100).aspx for more info.

Upvotes: 2

Related Questions