WPF in AppDomain and System.Runtime.Remoting.RemotingException

Code Wanderer 396 Reputation points
2020-03-21T21:47:19.797+00:00

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()));
}
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,694 questions
{count} votes