Strange behavior when I open Reportviewer in WPF

When I open a report in my WPF project once, I get this message with this message when I exit

{"Error while unloading appdomain. (Exception from HRESULT: 0x80131015)"} 

Stack trace:

 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() 

Is there something I'm doing wrong? I just open the form using windowsFormHost and ReportViewer inside. Do I need to close something before closing my application?

0
source share
1 answer

Microsoft error reported. However, there is a workaround for this - A workaround is to call

 reportViewer.LocalReport.ReleaseSandboxAppDomain(); 

before closing the parent form.

example:

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

You can look here to get any help: http://connect.microsoft.com/VisualStudio/feedback/details/522208/wpf-app-with-reportviewer-gets-error-while-unloading-appdomain-exception-on- termination

+4
source

Source: https://habr.com/ru/post/1436973/


All Articles