CodeWanderer-1205 avatar image
0 Votes"
CodeWanderer-1205 asked lextm commented

WPF in AppDomain and System.Runtime.Remoting.RemotingException

I created AppDomain where is created WPF application. Everything working untile some time pass, then I got this exception:

System.Runtime.Remoting.RemotingException: Object *.rem has been disconnected

Even when I have opened window with WPF GUI, it is working, until I close window and try open it again or delete the plugin or close application.

It looks like AppDomain trying to do something and it throw this exception.
Where can be problem?

How I create WPF app

 AppDomainSetup ^ ads = gcnew AppDomainSetup();
 ads->ApplicationBase = gcnew String(DllSystem::pathToDll.c_str());
 AppDomain ^ cd = AppDomain::CurrentDomain;
 appDomain_p1 = cd->CreateDomain("PluginProject1_GUI_Domain", AppDomain::CurrentDomain->Evidence, ads);
 try {
     appDomain_p1->DoCallBack(gcnew System::CrossAppDomainDelegate(this, &WPFP1::gui_wpf_p1::mf_AppCreateCallback));
 catch (Exception ^e)
     LoggerCPPInt::mf_writeLog("WPF::gui_wpf_p1::mf_App_Create()", "appDomain_p1->DoCallBack ERROR", msc::convert_to_string(e->ToString()));

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Your issue is more related about C++,this forum doesn't support.

0 Votes 0 ·

AppDomain is not C++. And I have issue with AppDomain, If I not run WPF inside AppDomain, I dont have this problem, but then I cannot use more then one WPF instance. Even code is not C++.

0 Votes 0 ·

The code you provide is not wpf(C# or code.

0 Votes 0 ·
Show more comments

1) The issue/exception is related to .NET Remoting, not WPF. That's why those Microsoft guys commented in that way. 2) Troubleshooting .NET Remoting issues can be quite difficult, as it is an obsolete technology nobody seriously uses any more. If possible, switch to other approaches (gRPC, JSON-RPC and others).

0 Votes 0 ·

0 Answers