0

I have a marshalled object which originated in another app domain.

Is there a way to get a reference to the app domain where the object was created from the object itself?

//i dont have a ref to this anymore.
AppDomain ad = AppDomain.CreateDomain("MyDomain");
MyRemoteObject r = (MyRemoteObject)ad.CreateInstanceFromAndUnwrap("MyCode.dll", "MyRemoteObject");

//is there a something such that i can re-discover the app domain
var appDomain = Something(r);
undefined
  • 33,537
  • 22
  • 129
  • 198

1 Answers1

0

Check out this answer of How to Get an AppDomain from an object

One possibility would be to create a property on your remote object. The remote object could then call AppDomain.CurrentDomain to get the remote AppDomain.

Community
  • 1
  • 1
Rob Archibald
  • 397
  • 3
  • 13
  • I had a look at that post but the answer is really talking about serialised objects not marshalled objects. Unfortunately I don't control the object at the other end of the app domain so I cant really just do an `AppDomain.CurrentDomain` in the remote domain. – undefined Sep 04 '14 at 00:28
  • @IllidanS4 it doesn't look like its been updated, it still requires actions from the remote object. – undefined Feb 28 '15 at 00:00