Sandboxing with AppDomain
Contents Introduction Prerequisites Sandboxing with AppDomain Putting it all together Introduction In the following, i will show you how to run partially trusted code and avoid polluting main application domain by sandboxing with AppDomain. Prerequisites IDE: Microsoft Visual Studio or Visual Studio Code Sandboxing with AppDomain To understand and apply this, first see: https://docs.microsoft.com/en-us/dotnet/framework/misc/how-to-run-partially-trusted-code-in-a-sandbox In addition to that: communication across application domains is made via a proxy (a class that extends System.MarshalByRefObject ); modifications on reference type parameters are available across application domains only for ref and out parameters; CreateInstanceAndUnwrap rises AssemblyResolve events in the application domain from which it was called for the specified assembly (i wasn't expecting that!!!). In the screenshot from above we...