views:

39

answers:

1

How do I programatically set the value of a static boolean in another app domain?

I'm testing an application where I need to change a bool value. Problem is that the bool value exists as a static instance on a type hosted in another app domain.

(I'm doing this for test purposes, it won't be used in production code)

+1  A: 

The only way you can do that (apart from IO, Socket or Remoting communication) is by calling AppDomain.DoCallBack to execute the code in another AppDomain.
For more information: http://msdn.microsoft.com/en-us/library/system.appdomain.docallback.aspx

But you cannot pass any data. So if you only need a Ping from one AppDomain to set the boolean value, you can use this approach. Otherwise you can find some more information here: http://stackoverflow.com/questions/2206961/sharing-data-between-appdomains

cornerback84