Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hi I created one AppDomain in my application and dynamically load an assembly to this appdomain. All these functionalities are working fine but i can't use an object from these dll.

I Created one class named Loader that inherits from MarshalByRefObject, load the assembly to this class. in my default appdomain use these class by using
loader = (Loader)domain.CreateInstanceAndUnwrap(typeof(Loader).Assembly.FullName, typeof(Loader).FullName);

I can use object from dll in newly created appdomain, but when i assign that object to any of my member inside my default appdomain then it gives the error like
Type 'WpfCustomControlLibrary1.Page1' in assembly 'WpfCustomControlLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.


Please give me a solution for this problem

Thanks in advance
Naufal k K
Posted
Comments
Sergey Alexandrovich Kryukov 23-Aug-11 18:27pm    
This is important question, my 5. Hope my answer will help you.
--SA

1 solution

First of all, do realize that different Application Domains are isolated from each other as thoroughly as processes. That said, you can exchange data and events between them using IPC, as in the case of different processes.

Now, additionally, the class System.AppDomain provides some special light-weight simplified means of IPC. Perhaps I will name not all of them but those I often used, but they are also the most important ones: the methods SetData, GetData and DoCallBack; using of those three could be enough for majority of purposes.

For more detail, see http://msdn.microsoft.com/en-us/library/system.appdomain.aspx[^].

—SA
 
Share this answer
 
Comments
Simon Bang Terkildsen 23-Aug-11 23:24pm    
+5
Sergey Alexandrovich Kryukov 23-Aug-11 23:39pm    
Thank you, Simon.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900