cancel
Showing results for 
Search instead for 
Did you mean: 

How to release ReportDocument or CrystalReportViewer instances ?

Former Member
0 Kudos

In a large WPF application using Crystal Report for Visual Studio 13.0.10, i detect that instances of CrystalReporViewer and ReportDocument are not released. I reproduce this in this small code :

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared Class MainWindow 

Private Sub buPreview_Click(sender As Object, e As RoutedEventArgs) Handles buPreview.Click     

'Création des données     

Dim listPerson As New List(Of Person)    

listPerson.Add(New Person With {.Name = "Denis", .PhoneNumber = "0473"})     

listPerson.Add(New Person With {.Name = "Laurent", .PhoneNumber = "0473"})     

listPerson.Add(New Person With {.Name = "Fred", .PhoneNumber = "0473"})     

listPerson.Add(New Person With {.Name = "Jean", .PhoneNumber = "0473"})    

'Création du report     

Dim R As New reportdocument     

R.Load("CrystalReport1.rpt")     

R.SetDataSource(listPerson)     

'Aperçu     

Dim wCR As New WindowPreview    

wCR.CRV.Owner = Window.GetWindow(wCR)    

wCR.CRV.ViewerCore.ReportSource = R     

wCR.ShowDialog()     

'Nettoyage     

wCR.CRV.Dispose()    

wCR = Nothing     

R.Close()     

R.Dispose()     

R = Nothing 

End Sub

End Class

I try a lot of thing without success and memory profiler indicates instances number increase after each preview Can you help me please ?

Message was edited by: Don Williams Formatted the code - Copy it into Notepad and then paste it in and it removed the formatting tags.

Message was edited by: denis chatelain new fact : I try the same thing in a Windowsforms application and it works. No instances of reportdocument or crystalreportviewer stays in memory.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Denis

This may be an issue with CR - we'd have to test that and see. Before I do have a look, I want to confirm that this indeed is a WPF app, not a winform app using the WPF viewer?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

I confirm my application is a WPF application.

PS:Sorry, i have send my response by mail reply and not  in this discussion.

Answers (0)