在WPF中打開報表查看器時出現奇怪的行為 [英] Weird behaviour when I open a reportviewer in WPF
本文介紹了在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();
}
這篇關于在WPF中打開報表查看器時出現奇怪的行為的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持IT屋!
查看全文