C#:AppDomain处理未处理的异常

C#:AppDomain处理未处理的异常,c#,exception,appdomain,unhandled-exception,C#,Exception,Appdomain,Unhandled Exception,我是appdomain概念的新手。以下是我关于处理appdomain恢复异常的问题: 当未处理的异常触发器是正确的处理方法时卸载appdomain吗 每次我调用appdomain时,我都必须将它放在trycatch中,这样无论调用过程中发生什么,我都要卸载以避免主域崩溃,这是最佳实践吗 我有我的父应用程序域,然后我创建了名为SandBox2的子应用程序域 AppDomain sandbox2 = AppDomain.CreateDomain("SandBox2");

我是appdomain概念的新手。以下是我关于处理appdomain恢复异常的问题:

  • 当未处理的异常触发器是正确的处理方法时卸载appdomain吗
  • 每次我调用appdomain时,我都必须将它放在trycatch中,这样无论调用过程中发生什么,我都要卸载以避免主域崩溃,这是最佳实践吗
  • 我有我的父应用程序域,然后我创建了名为SandBox2的子应用程序域

            AppDomain sandbox2 = AppDomain.CreateDomain("SandBox2");
            UpdateLog(string.Format("Created AppDomain {0}", sandbox2.FriendlyName));
            try
            {
                sandbox2.ExecuteAssembly(x.ToString()); //along here null exception is triggered
            }
            catch (Exception)
            {
                AppDomain.Unload(sandbox2);
            }
    
    多谢各位