Weird behaviour when I open a reportviewer in WPF

0

When I open a report in my WPF project once, I get this message 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 do wrong ? I just open a form with a windowsFormHost and a ReportViewer inside. Do I need to close something else before closing my application ?

.net
wpf
reportviewer
asked on Stack Overflow Aug 26, 2011 by David Brunelle • edited Dec 1, 2015 by Kiquenet

1 Answer

4

This is reported microsoft bug. However, there is a workaround for it - The workaround is to call

reportViewer.LocalReport.ReleaseSandboxAppDomain();

method before closing the parent form.

example :

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

}

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

answered on Stack Overflow Aug 26, 2011 by Rohit Vats • edited Apr 3, 2013 by XTGX

User contributions licensed under CC BY-SA 3.0