4

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)

Charles Sprayberry
  • 7,741
  • 3
  • 41
  • 50
Martin
  • 51
  • 1

1 Answers1

2

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: Sharing data between AppDomains

Community
  • 1
  • 1
ata
  • 8,853
  • 8
  • 42
  • 68