Posted 8 March 2020, 11:52 pm EST
Hello,
we are using ActiveReports 13.1.16872.0 in our .NET Framework 4.7.2 application. The application is running on a lot PCs of our customers (> 1000) without problems. On one PC the application is shutting down immediately when the printer dialog is opening by calling the “Print” method of a SectionDocument. This happens not always but in 50% of the cases.
The following .NET Framework exception is logged in the Windows event log:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at System.Drawing.SafeNativeMethods.DocumentProperties(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.String, IntPtr, System.Runtime.InteropServices.HandleRef, Int32)
at System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal(System.String)
at System.Drawing.Printing.PrinterSettings.GetHdevmode()
at System.Drawing.Printing.PageSettings.get_PaperSource()
at GrapeCity.ActiveReports.Viewer.Win.Controls.CustomPrintDialog.RunDialog(IntPtr)
at System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)
at GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.#zs(#r0B.#q0B, System.Action
1<System.Drawing.Printing.PrinterSettings>, Boolean) at GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.Print(#r0B.#q0B, Boolean, Boolean, Boolean, Boolean, System.Action
1<System.Drawing.Printing.PrinterSettings>)at GrapeCity.ActiveReports.PrintExtension.Print(GrapeCity.ActiveReports.Document.SectionDocument, Boolean, Boolean, Boolean, Boolean)
It is a PC with a hole bunch of avaliable local and network printers. My guess is that one of the printer drivers is causing the problem while retrieving the printer settings. Windows is up to date and at least the printer driver of the default printer should be up to date to. If I switch the default printer to “PDF creator” the error still occurs.
I wrote a test application (without ActiveReports) which called “System.Drawing.Printing.PrinterSettings.GetHdevmode()” for all of the printers. But it encounters no errors.
Does anybody know the cause of the problem and how to solve it? How could we find the invalid printer if this is the cause?
Thanks in advance!