How to install static bool in another application domain?

How to programmatically set a static boolean value in another application domain?

I am testing an application where I need to change the value of bool. The problem is that the bool value exists as a static instance for a type hosted in a different application domain.

(I do this for test purposes, it will not be used in production code)

+4
source share
1 answer

The only way to do this (other than IO, Socket, or Remoting) is to call 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 transfer any data. Therefore, if you only need Ping from one AppDomain to set a boolean, you can use this approach. Otherwise, you can find more information here: Exchange data between AppDomains

+2
source

Source: https://habr.com/ru/post/1304252/


All Articles