Unwrapping a non-serializable class from an appdomain
Because not all the classes used in the class I want to instantiate are serializable I can't unwrap.
Is this possible?
var appdom = AppDomain.CreateDomain(amServiceable.GetType().ToString());
var objectHandle = appdom.CreateInstance(amServiceable.GetType().Assembly.FullName,
amServiceable.GetType().FullName);
var plugin = objectHandle.Unwrap() as IPlugin //throws an error. that some cla开发者_如何学Pythonss in not marked serializable.
In order to use the Unwrap
method on an object it must derive from MarshalByRefObject
. If the object you want to manipulate doesn't then the only other choice is to use a different MarshalByRefObject
to manipulate the object in the other domain
精彩评论