How to set NetFx40_LegacySecurityPolicy for LINQPad?

I get NotSupportedExceptionwhen I use an outdated library from LINQPad. I found that this exception is caused by what Code Access Securityis .NET Frameworkmissing.

https://msdn.microsoft.com/en-us/library/ee191568(v=vs.110).aspx

Therefore, I add the file <NetFx40_LegacySecurityPolicy>in LINQPad.configaccordance with the MSDN article, but it still calls Exception. Adding a configuration item to LINQPad.UserQuery.exe.confighelps me, but it seems to be restored at startup LINQPad.

Is there any other way to add a configuration item for LINQPad?

(And why this element does not work in LINQPad.config...)

Example (calls the same Exception):

// Add reference for System.Security.dll and import namespace System.Security.
new HostSecurityManager().DomainPolicy
+4
source share
2 answers

NetFx40_LegacySecurityPolicy is unusual in that it must come from the configuration file for the process, and not from the AppDomain.

If you disable process isolation in LINQPad, a workaround is to set the parameter LINQPad.exe.configinstead LINQPad.config.

This workaround does not work with process isolation enabled, however it will be discussed in the LINQPad update (v5.05.04). A beta version will be released shortly.

+1
source

Since it launches , used to run each request in a new rather than a new one , I assume that the "limited" program itself is : (I donโ€™t know which version is used, so this is a possible solution.) LINQPad AppDomainProcessLINQPad.exeLINQPad

LINQPad AppDomains

LINQPad LINQPad.exe.config, LINQPad.config, .

, , :

<configuration>
   <runtime>
      <NetFx40_LegacySecurityPolicy enabled="true|false"/>
   </runtime>
</configuration>
+1

Source: https://habr.com/ru/post/1626558/


All Articles