We have some code that creates a new appdomain to perform a untrusted calculation.
We are hitting a serialization exception creating the new appdomain because of some data that is stored in:
System.Runtime.Remoting.Messaging.CallContext
We were able to verify that clearing the data before creating our appdomain fixed the problem.
System.Runtime.Remoting.Messaging.CallContext.SetData( "USER_ACTIONS_LOGGED", null );
But I'm wondering, is there a way to create the new appdomain so that it does not use the existing remoting CallContext?
Otherwise we can probably try getting the data, clearing it, and restoring it later. But that seems less than ideal.
Our exception is:
System.Runtime.Serialization.SerializationException
HResult=0x8013150C
Message=Type is not resolved for member 'PL.Data.UserActions.ButtonAction,PLDefinition...'.
Source=mscorlib
StackTrace:
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName)
at CodeDOMScripting.Sandboxer.RunSandboxed(String fullPathToCompiledDll, String className, String methodName, List`1 parameterNames, List`1 parameters, Int32& refCalctime, String& traceMessagesString)
This exception was originally thrown at this call stack:
[External Code]
CodeDOMScripting.Sandboxer.RunSandboxed(string, string, string, System.Collections.Generic.List<string>, System.Collections.Generic.List<System.AddIn.Contract.RemoteArgument>, ref int, ref string) in Sandboxer.cs