I am trying to call DoCallBack for multiple AppDomains, but it is not asynchronous. Is there a way to make the calls asynchronous? Here is what I am attempting to do:
var appDomain1 = System.AppDomain.CreateDomain("event1");
var appDomain2 = System.AppDomain.CreateDomain("event2");
Console.WriteLine("Executing appDomain1");
appDomain1.DoCallBack(new CrossAppDomainDelegate(Event));
Console.WriteLine("Executing appDomain2");
appDomain2.DoCallBack(new CrossAppDomainDelegate(Event));
I am attempting to execute the method “Event” in multiple appDomains asynchronously.
You could use the TPL, and call DoCallBack from a Task: