You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a .NET 4.5.2 application (console in this case), trying to create a list of tuples results in a method access exception, if the assembly is marked for allowing partial trusted callers:
Unhandled Exception: System.MethodAccessException: Attempt by method 'ConsoleApp2.Program.Main(System.String[])' to access method 'System.Collections.Generic.List`1<System.ValueTuple`2<ConsoleApp2.Foo,System.__Canon>>..ctor()' failed.
at ConsoleApp2.Program.Main(String[] args) in c:\ConsoleApp2\Program.cs:line 17
I only see this in .NET 4.5.x applications, not in .NET Core.
The text was updated successfully, but these errors were encountered:
Thanks @jbogard for reporting this.
I'm able to repro (copied exception details below). I'll investigate.
System.MethodAccessException occurred
HResult=0x80131510
Message=Attempt by security transparent method 'ConsoleApp1.Program.Main(System.String[])' to access security critical method 'System.ValueTuple`2<System.Int32,System.Int32>..ctor(Int32, Int32)' failed.
Assembly 'CsPartialTrust, 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.
Source=CsPartialTrust
StackTrace:
at ConsoleApp1.Program.Main(String[] args) in d:\issues\PartialTrust\CsPartialTrust\Program.cs:line 13
In a .NET 4.5.2 application (console in this case), trying to create a list of tuples results in a method access exception, if the assembly is marked for allowing partial trusted callers:
Exception returned:
I only see this in .NET 4.5.x applications, not in .NET Core.
The text was updated successfully, but these errors were encountered: