[2005] VB.Net -> Crystal Reports C++ Runtime Error
Hey Guys,
WOW BusinessObjects.com is hard to navigate and find good info! Hence I pose my question to you learned folk…
I have an issue with Crystal Reports included with VS.Net 2005. Please see the screen shot of the error attached.
This error message is displayed when trying to view a report using the Crystal Reports viewer. I am using the push data method, i.e I create and populate a dataset and then ‘push’ it onto the report. I then set the report source for the viewer and call show for the form – all standard stuff. Now this all works beautifully BUT if I switch between other applications before the report is displayed I am greeted with this error message (attached):
Runtime Error!
Program: <AppPath>
R6025
-pure virtual function call
Upon clicking OK my whole app catastrophically fails, down she goes….
All the code is sitting inside Try, Catch, Finally blocks so any error produced by my code *should* be caught. Could anything about my code be provoking this situation?
Obvious answer: Don’t switch between apps! But the report can take up to a couple of minutes to display, users have work to do. Further more it should be possible just by principle – I mean that’s the whole reason behind a multitasking environment.
I attempted the obvious solution and went searching for any service packs or hot fixes but none have been released yet for 2005 (as far as I can see – please correct me if not).
This code works EVERYTIME I keep focus on my app, if I switch to another app the error message is displayed right before the viewer actually renders the report. Its definately making it to 'frmRptView.Show()' because the form pops up, the viewers controls are all placed along the top and then BOOM error!
Tearing my hair out! Looks like it may be in the CR runtime? It occurs on my both my Dev machine and end users machines. Occurs when running from the IDE or exe on my Dev box. I have deployed the CR.Net 2005 merge modules to the client machines using an MSI built in VS2005.
Apologies for the length of the post but trying to provide as much info as possible.
Many thanks in advance for any suggestions, ideas or possible solutions.
Matt.
Last edited by GottaGetITDone; Aug 29th, 2006 at 11:40 PM.
Re: [2005] VB.Net -> Crystal Reports C++ Runtime Error
After a little research I can confidently say its an error with the way I'm using the CrystalReportViewer or the CrystalReportViewer itself. When the error does not occur, I hover the mouse over the viewer's toolbar and am greeted with a hourglass cursor. The crystalreportviewer is having trouble with something.
Another problem: If the report is two pages (and it displays succesfully), I cannot view the second page. When I click the arrow to go to the next page I am shown the classic "Object reference not set to an instance of an object". However if I print the report from code the two pages are outputted from the printer - the data exists!
This is all the code in frmRptView in case anyone can see something?
VB Code:
Private Sub frmRptView_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
crView.DisplayGroupTree = False
crView.Zoom(80) '2 for full page
End Sub
Private Sub frmRptView_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If Me.WindowState = FormWindowState.Maximized Then
cMain.frmMDIMain.NormaliseChildren()
End If
End Sub
Private Sub frmRptView_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.Dispose()
End Sub
WHATS GOING ON?!!?! Going crazy!
Surely its me, surely its the way Im doing something...
Re: [2005] VB.Net -> Crystal Reports C++ Runtime Error
I was wasting my time...
After a lengthy process with Business Objects support I have come to the conclusion the CrytsalReportViewer in 2005 is flawed.
This code worked perfectly on 2003 .Net 1.1
In my original post you can see that I dispose of my report object after I have sent it to the form that contains the viewer. This is causing the weird focus problem.
If I dont dispose of the report object there is no problem. Why is this so? Wouldn't the set parameter of 'Public Property ReportSource As Object' be declared as ByVal? Shouldn't it take a copy and allow me to dispose of my object??
This is not a solution. I am left with memory leaks as the report object is not disposed.
The Crystal support engineeer is quoted saying:
I am glad to hear that you have found the cause of the problem. You can dispose the report object either in the closing or closed event of the form.
Kindly let me know if this helps.
How do I do this?!? I assume he means the form the has the viewer and not the form that generates the report object. The ReportSource property returns an object, it exposes no dispose method. If I cast it to a variable I get a copy not a 'pointer'. I shouldn't have to worry about this anyway, the viewer should kill its copy of the report object.
This is not the object I am trying to dispose, I am trying to dipose the object in Sub 'ShowExecRpt'.
How do I dispose of my report object??
Last edited by GottaGetITDone; Sep 5th, 2006 at 07:34 PM.