Monday 23 May 2016

Error: Attempt by security transparent method

-------------------------------------------
[assembly: AllowPartiallyTrustedCallers]
[assembly: SecurityTransparent()]
---------------------------------------------

Error: Attempt by security transparent method
'MyClass.MyFunction(System.String, System.String, System.String, System.String, System.String, System.String, Boolean)'
to access security critical method 'System.Type.GetTypeFromProgID(System.String)'
failed. Assembly 'MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
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.
Solution: [assembly: SecurityTransparent()]
or comment
//[assembly: AllowPartiallyTrustedCallers]


 
Error: Attempt by security transparent method
'MyClass.MyFunction(System.String, System.String, System.String, System.String, System.String, System.String, Boolean)' to access security critical method 'System.Type.GetTypeFromProgID(System.String)' failed.
solution :   [SecuritySafeCritical] over class and methods