title: Attempt by security transparent method X to access security critical method Y failed
body: <p>I have a fairly stable server application version that's been deployed for nearly a year at dozens of customers.</p>
  
  <p>One new customer recently setup the application and is getting the following error:</p>
  
  <blockquote>
    <p>System.MethodAccessException: Attempt by security transparent method
    [SomeMethod] to access security critical method [SomeOtherMethod]
    failed.</p>
  </blockquote>
  
  <p>Both SomeMethod and SomeOtherMethod are methods in assemblies that I wrote, that are built against .NET 4, and that are running inside a Windows Service. If it makes a difference, SomeOtherMethod does reference a type from a 3rd party assembly (EntLib 4.1) built against .NET 2.0. Looking at the code for EntLib 4.1, I do see that they use both SecurityTransparent and APTC attributes, but this has never caused issues at other clients.</p>
  
  <p>These assemblies were upgraded from the .NET 2.0 CLR, but a long time ago. This exact code is running on other customers just fine, and I'm not explicitly using the APTC attribute nor am I using the SecurityCritical attribute anywhere.</p>
  
  <p>This leads me to the conclusion that it's a configuration issue or perhaps .NET Framework patch issue. Has there been a patch released for .NET that would cause this breaking change? Is there a configuration setting some where that enforces this type of check which is off by default but that my customer may have enabled?</p>
  
  <p>One last point. My service utilizes SSRS RDLCs to generate PDFs. Due to some changes in .NET 4, I must force the service to use the legacy security policy via the following config:</p>
  
  <pre><code>  &lt;runtime&gt;
      &lt;NetFx40_LegacySecurityPolicy enabled="true" /&gt;
    &lt;/runtime&gt;
  </code></pre>
  
  <p>For more details on why I need to do this, see this stackoverflow post: <a href="https://stackoverflow.com/questions/6220915/very-high-memory-usage-in-net-4-0/">Very High Memory Usage in .NET 4.0</a></p>
  
  <p>The important point is that I do this at all my other customers as well. Only this one customer is having issues.</p>