Passing objects across Appdomains

Posted by MUSTAQ on Stack Overflow See other posts from Stack Overflow or by MUSTAQ
Published on 2010-03-17T03:37:45Z Indexed on 2010/03/17 3:41 UTC
Read the original article Hit count: 213

Filed under:

My issue is similar to the one posted in "http://stackoverflow.com/questions/981773/moving-objects-across-appdomains-in-net".

In one of my application, I am creating a separate appdomain. I need to create an instance of a class (Note: this class is derived by MarshalByRefObject) in my parent domain and invoke a MethodA in that instance. This instance is created using "CreateInstanceAndUnwrap". The problem is that this MethodA takes objects of type class as an argument. These objects are not created in the MethodB where i created the appdomain. It was passed as an argument to the MethodB where i create the appdomain. So is it necessary to create a new instance of these objects using "CreateInstanceAndUnwrap" before passing it to the created domain. Not doing this gives me an error in the created domain mentioning that "MyClass object has no attribute foo" during some invocation.

Please let me know how to pass the objects across appdomains and execute the method. My statements might be confusing, please let me know for any specific details required.

© Stack Overflow or respective owner

Related posts about appdomain