on 05-25-2015 1:31 PM
Hi all,
I am having an issue with the Chart features of CR. Since adding a chart to my report I keep getting these gdi+, system.drawing errors. It happens whenever I try to print the report OR if I make a chart using the group way and double click it.
I'm using what i believe is the latest version of Crystal Reports for Visual Studio 2012.
Any help will be greatly appreciated.
Can you attach the report so I can test and check it?
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Don and thanks for the quick reply.
I have failed to upload the .rpt file because the forum doesn't allow me to upload that type of file. What I have done is export xml (twice, once with the drill down open and once closed). If you have a way to upload the RPT just let me know and Ill do it.
The chart is in a drill down header and I don't necessarily want the users to be able to print it but I can't have the app crashing every time the user clicks print while the chart is in view or double clicks the chart (in case of drill down charts). Also I am working on Windows 8 64 bit operating system. I am showing the report using a wpf Window with ShowDialogue method.
Update:
I have created a different report with a chart as part of the same project (same app) and were having no problems until I hid the the header and enabled the option show all headers on drill down. This seems to be what is causing the problem. If I just show the chart on the front page I have no issues however if I hide it and use drilldown or subreport ( tried that too) I get the error. Even if I don't hide it I can replicate the error. what I do is drill down in the chart and then close that window. Then I click the next page button, to leave the page with the chart, then back to go back to it, then next, and then back, at which point the app crashes with the same error.
Message was edited by: Dino Kant
Ok I finally managed it I was on Windows 8 and theres a process for doing it cos it doesn't show u the file type, anyways im an idiot but it should be ok now, im sending u 2 reports, one has the chart hidden as part of the header so u have to drill down to it and the other is shown right in the report.
This is how Id trigger the error
if I hide the report and use drilldown or subreport ( tried that too) I get the error. Even if I don't hide it I can replicate the error. what I do is drill down in the chart and then close that tab (which leads me back to the main report page). Then I click the next page button, to leave the page with the chart, then back to go back to it, then next, and then back, at which point the app crashes with the same error.
Hi Dino,
Yes I did get them but paid cases come first... Nothing unique in the reports and very simple but I do see you are using a Dataset.
Can you set Location to the actual database using ODBC or OLE DB? Could be ADO.NET doesn't like something in the data set.
Are previewing in the VS IDE when designing the report or are you running in DEBUG mode and previewing? Have you tried both?
Don
HI don
I Cannot set the location of the database using Oledb as the app uses Castle Active Records for database communication. I tried running it in debug mode not in preview really but will test and let you know what happens
After testing I discovered I cannot preview the reports that are causing me problems. When I go to preview I get a pop up:
Server Name
Data_Objects.Castle_Active_Record.KlaseObjekti.ReportKlasa
User Name
Password
Use Single Signon Key
false
No matter what User Name and Password combo I try I can't get through, whether its my domain authentication for Windows or database username and password...
Message was edited by: Dino Kant
Hi Dino,
I reread this note:
if I hide the report and use drilldown or subreport ( tried that too) I get the error. Even if I don't hide it I can replicate the error. what I do is drill down in the chart and then close that tab (which leads me back to the main report page). Then I click the next page button, to leave the page with the chart, then back to go back to it, then next, and then back, at which point the app crashes with the same error.
This kind of rings a bell now. There was an issue in one of our 3rd party components that caused a memory leak which is what this could be or possibly a GDI over use.
In Task Manager add GDI Objects and have a look at them while paging back and forth... See if the number goes way up..
The reports you attached do not have saved data. Can you export to RPT format or Preview the report and select the option to save data and then attach?
I can test also.
Don
Hi Don,
As I explained in my earlier post I can't preview the reports so I'm attaching the reports exported to rpt format (but renamed so its not rpt)
I also checked out the GDI objects and from what I could gather the value never goes above 89. I couldn't really page through data because I don't have a lot of data in the database right now for a big report but the chart is a subreport so i would enter and exit the chart (click on link, close tab, repeat) until the app crashes and it didn't seem to rise too much (it would be around 80 when I'd start the report).
Hi Dino,
OK, so the ForDon.rpt and ForDon2.rpt have saved data but in both the subreport is OnDemand, so I can't test it.
for the f.rpt report I can page back and forth in the same order you do and no problems for me.
Can you run debugdiag and analyze it and see what it tells you when the crash happens?
I think I found the cause... upgrade to SP 14. You are still using SP 10:
There was a memory leak in that build that was fixed in SP 12...
Don
relatively easy to do. A wizard should start up, select Crash and then browse to your process and use the defaults,
Run the app and then cause the crash to happen. In Debugdiag, click on the Analize tab and Add and you should see a folder created with the dump file in it. Open that folder up and select the file(s) than OK
It should output a HTML file with info in it.
Don
I did it, but I had to do it manually. When I created the rule for my app process nothing would happen when it crashed. No dump would be generated. So what I did was I crashed the app and then in the program went to processes found it and created a full userdump manually... Anyhoo i analyzed it and got this. (I am running debugdiag 2.0 just fyi).
I don't think the problem is the printer because as I've told you I can generate the error without printing. I just wanna make sure we are talking about the same thing when you say WPF viewer,
This is my wpf code that:
<my:CrystalReportsViewer HorizontalAlignment="Center" Name="crystalReportsViewer"
VerticalAlignment="Center" Margin="5,5,5,5" ToggleSidePanel="None" ShowRefreshButton="False" ShowToggleSidePanelButton="False"/>
Also I have a reference to SAP Business objects WPF Viewer is that the one you are referring to?
Second I have realized I can make the error go away if I make the chart much smaller... I am working on a 64bit machine using windows 8
Hi Dino,
Crystal Reports is WYSIWYG which requires a Printer driver to generate the page. So even though you are not printing CR is still using your default printer to format the page when previewing and designing. If you select a specific printer in Page Setup then it will use that one to format the page. If you select No Printer in Page Setup then CR uses GDIPlus to format the page with some generic paper sizes.
The error goes away because it does not fit on your paper size. If you create/select a custom paper size and use that as your printer source the error would likely go away also.
So what you are doing is sizing the chart to try to fit onto a page it does not fit onto. And possibly you are using the XPS printer driver, that driver is not very good, it has orientation issues, it can't print landscape and few other limitations.
So when designing a report use a real printer. If you need to use a custom paper size use No Printer and User Defined or a printer that supports custom paper sizes.
Don
I am not using the XPS printer driver I am using the HP LaserJet 4200/4300 PCL6 Class Driver.
This is my page setup. I checked it with a report that I am using that has no chart and is therefore problem free and it is exactly the same as the one there.I also tried changing the paper size from A4 to user defined and had no success, the error would occur when opening the report, didn't even have to do anything.
Hi Dino,
Interesting.... This suggests there is a hardware dependency that we may not be aware of. CR is hardware dependent so it could be the Screen resolution, or possibly your video card/driver and or DPI settings causing this issue for you....
There was one other case I remember a while ago that with specific versions of hardware and the OS and the drivers caused a similar issue, but I don't recall the details now....
I'll try to find that old e-mail thread and see if it helps at all... We could not replicate because it was specific hardware which we do not have...
Don
Could be I honestly don't know. Its interesting because as I was adjusting the size I noticed there is a sort of threshold and if I pass it it will break but if I pass it a little it will last longer in terms of changing pages etc like switching from the chart to something else. So if I make it just a stretch bigger I will switch 10 times with nothing happening and then it will crash while if I make it a lot bigger it will just crash when it loads. In the end I was just switching pages and pressing the print button like a crazy person counting as I go to see it all works below the threshold
After some testing I don't think it's a resource issue. I opened up a bunch of applications and it didn't influence how many attempts it took for the report to fail compared to only running visual studio and the app. Also if I've made a project with 2 reports the 2 seem to be linked. And the issue seems to be directly related to size. So say I have 2 reports one size 50 and one size 20. I can open the one size 20 ten times and the one size 50 four times or if I open the one size 50 three times I can then open the one size 20 2 more times before it fails. It's like something is not being cleared when I close the chart and is accumulating until it gives the GDI error but I'm not sure what.
Ok this code worked for me I found it on a different scn thread that I have since lost but here is the code:
private void CloseGracefully()
{
var objRptDocViewer = (ReportDocument)this.crystalReportsViewer.ViewerCore.ReportSource;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in objRptDocViewer.Database.Tables)
{
table.Dispose();
}
objRptDocViewer.Database.Dispose();
objRptDocViewer.Close();
objRptDocViewer.Dispose();
report.Close();
report.Dispose();
report = null;
if (this.crystalReportsViewer.ViewerCore.ParameterFieldInfo != null)
{
this.crystalReportsViewer.ViewerCore.ParameterFieldInfo.Clear();
this.crystalReportsViewer.ViewerCore.Dispose();
this.crystalReportsViewer.Owner = null;
this.crystalReportsViewer = null;
}
}
crystalReportsViewer is the name I gave my wpf crystal reports viewer. And report is the .rpt file.
So what I did was I found this code on the thread and created a method that gets called when the window that holds the WPF viewer is closed. It clears out everything and since then I have had no issues with the GDI Error. Hope it helps anyone else with this issue.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.