Skip to Content
0

Application crashes on ReportDocument.Load

Jun 07, 2017 at 07:36 PM

45

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Amaury Relies Jun 08, 2017 at 09:54 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Jun 07, 2017 at 07:39 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Amaury Relies Jun 08, 2017 at 07:25 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded