c# - ObjectHandle unwrap gives me a MarshalbyRefObject object instead of my class object -
i'm trying load assembly in appdomain , seems problem objecthandle.
assembly contains 1 class:
namespace mytestassembly { using system; public class someclass : marshalbyrefobject { public virtual bool run() { return true; } }
and in assembly b try invoke class this:
var assembly_path = "/path/to/something.dll" system.appdomain appdomain = system.appdomain.createdomain("mydomain"); system.runtime.remoting.objecthandle oh = appdomain.createinstancefrom(assembly_path, "mytestassembly.someclass"); object obj = oh.unwrap(); obj.gettype().invokemember("run", system.reflection.bindingflags.invokemethod, type.defaultbinder, obj, null); appdomain.unload(appdomain);
this gives me exception:
an exception of type 'system.missingmethodexception' occurred in mscorlib.dll not handled in user code additional information: attempted access missing member.
and if check type of obj marshalbyrefobject when expect "someclass" object. did miss here? have tried @ examples , seems how people it.
Comments
Post a Comment