Error while unloading AppDomain. (Exception from HRESULT: 0x80131015)

本文介绍了一个在PRISM中使用ReportViewer时遇到的已知BUG,并提供了简单的解决方案:通过在窗体关闭前调用ReleaseSandboxAppDomain()方法避免程序退出时出现的异常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用PRISM时, 使用了Windows Form Host 加载了Report View11控件,  窗体关闭后, 在退出PRISM程序时, 系统抛出异常


Error while unloading AppDomain. (Exception from HRESULT: 0x80131015)


这是微软已知的一个BUG, 详情参见

http://connect.microsoft.com/VisualStudio/feedback/details/522208/wpf-app-with-reportviewer-gets-error-while-unloading-appdomain-exception-on-termination


解决方案相当简单:

在关闭ReportViewer调用的窗体之前执行 reportViewer.LocalReport.ReleaseSandboxAppDomain() 事件即可. 如:

private void frmMyForm_FormClosing(object sender, FormClosingEventArgs e)
{
    reportViewer1.LocalReport.ReleaseSandboxAppDomain();
}

这样就不会有问题了.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值