在WPF中打开报表查看器时出现奇怪的行为 [英] Weird behaviour when I open a reportviewer in WPF

查看:0
本文介绍了在WPF中打开报表查看器时出现奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在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

这篇关于在WPF中打开报表查看器时出现奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆