?
Solved

How to fix "Error while unloading appdomain." error in VB.net?

Posted on 2014-09-07
5
Medium Priority
?
2,955 Views
Last Modified: 2016-09-18
Hello,

Using VB.net in VS2010.

I have a Main form and then a Reports form.  This Reports form has a ReportViewer, called rptExpenses.  When I load the Reports form, the following code runs:
Private Sub frmReports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim SQLText As String = "SELECT * FROM expenses"
        Dim SQLData As DataTable = DBGetTable(SQLText)
        Me.rptExpenses.LocalReport.DataSources.Clear()
        Dim rprtDTSource As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource(SQLData.TableName, SQLData)
        Me.rptExpenses.LocalReport.DataSources.Add(rprtDTSource)
        Me.rptExpenses.LocalReport.ReportPath = "C:\Users\Jason\Documents\Visual Studio 2010\Projects\Remote-Expense\Remote-Expense\Report1.rdlc"
        Me.rptExpenses.RefreshReport()
    End Sub

Open in new window

Here's the problem: Everything works fine, however, when I exit the entire application (not the Reports form), I get the following error:

Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
Screenshot:Error while unloading appdomain. (Exception from HRESULT: 0x80131015)Commenting out this one line removes the error:
Me.rptExpenses.LocalReport.ReportPath = "C:\Users\Jason\Documents\Visual Studio 2010\Projects\Remote-Expense\Remote-Expense\Report1.rdlc"

Open in new window

[u]Questions:[/u]
What am I doing wrong?
And how can I fix it?


Thanks!
0
Comment
Question by:SqueezeOJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 2000 total points
ID: 40308721
you need to execute below statement in Form Closing Event.

Me.rptExpenses.LocalReport.ReleaseSandboxAppDomain()
0
 

Author Closing Comment

by:SqueezeOJ
ID: 40308769
Excellent - Thanks!
0
 
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 40313812
Thanks @Netminder
0
 

Expert Comment

by:Jonathan Arias
ID: 41804130
Hola amigo buenas tardes, te saludo desde Colombia, aplicando la solución que tu aportas al problema del compañero, a mi me sale un error con el código.
Me.rptExpenses.LocalReport.ReleaseSandboxAppDomain() = rptExpenses me aparece como error y no me deja soluciona la falla. es la misma expuesta por el compañero primero. Agradezco su colaboración.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question