问题描述
当我在WPF项目中打开报表一次时,退出时收到以下消息
{"Error while unloading appdomain. (Exception from HRESULT: 0x80131015)"}
堆栈跟踪:
at System.AppDomain.Unload(AppDomain domain) at Microsoft.ReportingServices.RefCountedAppDomain.Dispose() at Microsoft.Reporting.WinForms.LocalReport.ReportRuntimeSetupHandler.ReleaseSandboxAppDomain() at Microsoft.Reporting.WinForms.LocalReport.Dispose() at Microsoft.Reporting.WinForms.ReportInfo.Dispose() at Microsoft.Reporting.WinForms.ReportHierarchy.Clear() at Microsoft.Reporting.WinForms.ReportViewer.Dispose(Boolean disposing) at System.ComponentModel.Component.Finalize()
我是不是做错了什么?我只是打开了一个内部带有windowsFormHost和ReportViewer的窗体。在关闭应用程序之前,我是否需要关闭其他内容?
推荐答案
这是报告的microsoft错误。但是,有一种解决方法- 解决方法是调用
reportViewer.LocalReport.ReleaseSandboxAppDomain();
关闭父窗体之前的方法。
示例:
private void frmMyForm_FormClosing(object sender, FormClosingEventArgs e) { reportViewer1.LocalReport.ReleaseSandboxAppDomain(); }
您可以在此处查看任何关联: http://connect.microsoft.com/VisualStudio/feedback/details/522208/wpf-app-with-reportviewer-gets-error-while-unloading-appdomain-exception-on-termination