卸载应用程序域时出错。 (HRESULT 异常:0x80131015)关闭表单时发生
我正在使用登录表单来获取主表单。当密码正确时,登录表单调用主函数。即使我命令登录表单关闭,它也不会显示为关闭,它在任务栏中仍然最小化。但是,当我关闭主窗体时,会出现异常“卸载应用程序域时出错。(来自 HRESULT 的异常:0x80131015)”。请帮忙。
I am using a login form to get a main form. Login form calls the main when the password is correct. Even if I commanded the login form to close, it doesnt show as closed, it remains minimized in the taskbar. But when i close the main form when its running the exception "Error while unloading appdomain. (Exception from HRESULT: 0x80131015)" is given. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Winforms 不支持 AppDomain。它会爆炸,因为表单无法关闭。它甚至不知道它的存在,它在另一个AD中。不要尝试使其工作,仅在默认域中创建表单。
Winforms doesn't support AppDomains. It bombs because the form won't close. It doesn't even know it exists, it is in another AD. Don't try to make this work, only create forms in the default domain.
这是 Microsoft 报告的错误。有一个解决方法 - 在关闭父窗体之前调用 reportViewer.LocalReport.ReleaseSandboxAppDomain() 方法。
例子:
This is a reported Microsoft bug. There is a workaround for it - to call reportViewer.LocalReport.ReleaseSandboxAppDomain() method before closing the parent form.
Example:
修改 FormClosing 事件期间发生的情况,只需添加 reportViewer1.Dispose();
Modify what happens during the FormClosing event, in there you just have to add reportViewer1.Dispose();