c# - Cross AppDomain async method call -


from main appdomain, trying call async method defined in type instantiated in different appdomain.

for example, following type myclass inherits marshalbyrefobject , instantiated in new appdomain :

public class myclass : marshalbyrefobject {   public async task<string> fooasync()   {      await task.delay(1000);      return "foo";   } } 

in main appdomain create new appdomain , create instance of myclass inside appdomain, make call async method.

var appdomain = appdomain.createdomain("mydomain"); var myclass = (myclass)appdomain.createinstanceandunwrap(typeof(myclass).assembly.fullname, typeof(myclass).fullname); await myclass.fooasync(); // bam ! 

of course, serializationexception when try make call, task type not inherit marshalbyrefobject, nor serializable.

how arround ? able call/await on async methods type instantiated in appdomain ... there way ?

thanks !


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -