cancel
Showing results for 
Search instead for 
Did you mean: 

Application crashes on ReportDocument.Load

Former Member
0 Kudos

I'm developing a win app in C# using CRforVS 13sp20 and .NET Framework 4 which is basically open a selected report, set the data source to an Oracle database using ReportDocument.Table.LogOnInfo on each tables from the report and subreports and then show the report with CrystalReportViewer.

It works pretty well except for CR9 Reports. The application crash when I try to set the data source. It seems that after the ReportDocument.Load, the report is not completely loaded and if I try to do a quick watch on that object in Visual Studio the application crash too.

I tried a lot of samples available on your wiki and got the same result. I'm using CR SDK but I also tried with RAS SDK and the application crashed when I did a ReportDocument.ReportClientDocument.DatabaseController.SetTableLocation.

Actually the only way I found to open the report is to directly open the rpt in Visual Studio (open Files...) and define the datasource location, update it, then save the report. After that I can open it properly in my application.

I hope I can do the same programmatically.

I'm on windows 10 64 bits, using CRforVS 13sp20 but I already did have this issue with the sp19. I also have this problem with both x86 and x64 targets.

Any help would be much appreciated. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Well, I finally found out the solution and feel pretty stupid about now.

In Visual Studio, clean and regenerate the solution. That's it.

Thank you again and sorry for the false alarm.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you for your answer.

Sorry I didn't specify that I already have a try/catch in the Load routine and it catches anything.

I have thousands of CR9 reports, so is there a solution to achieve programmatically the same result than the manually update ?

Tried to load, save, then reload the saved report didn't work.

0 Kudos

Try adding a try/catch in the Load routine to see if it catches anything and/or catch the inner exception, something like this:

if (ex.InnerException.Message != null)

If that doesn't help only option is to update the reports manually, something could be corrupted in the CR 9 RPT file itself causing the issue.

Resaving in VS "fixes" what that may be.

Don