Attempt by security transparent method \'PayPal.UserAgentHeader.get_OperatingSystemFriendlyName()\' to access security critical method \'System.Management.Management
I was working on a brownfield application with a lot of referenced projects in the solution. One project was set to .NET 4.0 instead of 4.6.1 and I thought that might be it, but that wasn't the issue. I had to add:
[assembly:AllowPartiallyTrustedCallers]
to the assembly.cs file in the project containing the "security critical" method, and it wasn't happy with me until I also added
using System.Security;
That did the trick.
Joey