1
votes

I need to pass an instance to (not from) an AppDomain. I've seen a lot of info about how to do the reverse (call create on a domain and use the object locally), but what i want is to pass an instance i already have (not one i create from the domain object), this instance is a MarshalByRefObject and i want to pass it to another domain from my main domain. Is this possible at all?

   var MyObject = GetAlreadyPopulatedObject();
   AnotherDomain.MakeObjectVisible(MyObject); // this is what i'm trying to do, make the instance i have available somewhere else
   // And if it's possible, how would i access it from the other Domain? How can i find it?

The scenario i have is i'm handling data that i create, i want to pass it for manipulation to a plugin in another appdomain, and then to retrieve the modified version and i'm a bit at a loss.

1
The point of MBRO is that the code in the other appdomain uses a proxy and not the real object. If that's not what you want then you should not use MBRO and make it [Serializable] instead.Hans Passant
My items can be serializeable too, but i couldn't find how to pass them across domain, i've found SetData and GetData in between but i hoped there was a richer way to work with thatRonan Thibaudau

1 Answers

0
votes

In the end i found an alternative (domain.SetData / domain.GetData) to pass objects across domain boundaries, i'm not sure if it's the cleanest / easiest / fastest / recommanded etc to do this so not marking myself as an answer unless i see no other answers after a while.