I have a slight problem transferring some data between two .NET domains, and I hope someone here can help me.
Basically what I have is the main application ( Main ), which loads the main A and B into it , then when I run the plugin ( C ), the Main calls the domain B domain method , which creates a new domain and loads C and instance B so that C can access only B and not others.
B contains a pointer to IDispatch Main , but only it seems to get it after loading it into a new domain using C. What I'm trying to do is send a copy of the pointer from a new instance of domain B and send it to A , which is still works in the default domain.
For recording only, I control A, B and C , but not Home
Sorry if this is a little hard to understand, I tried to explain it.
code:
In A:
public class Tunnel : MarshalByRefObject
{
public void SetPointer(int dispID)
{
IntPtr pointer = new IntPtr(dispID);
}
}
In B:
public void CreateDomain()
{
AppDomain maindomain= AppDomain.CurrentDomain;
tunnel = (Tunnel)maindomain.CreateInstanceAndUnwrap(typeof(Tunnel).FullName,
typeof(Tunnel).FullName);
AppDomain domain = base.CreateDomain(friendlyName, securityInfo, appDomainInfo);
typeof(Tunnel).FullName);
tunnel.SetPointer(
}
So in the end it looks something like this:
Default Domain:
Connect domain:
source
share