ReportPro 3.60 for XSharp 2.60 memory exception

This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
User avatar
Michal Rajnoha
Posts: 22
Joined: Wed Sep 29, 2021 6:57 am

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by Michal Rajnoha »

Chris wrote: Thu Apr 25, 2024 8:33 am Hi Michal,

Thanks for the very good sample, but unfortunately I could not reproduce the problem here, all 65 pages are always printed ok here. Does the problem happen with any printer driver? Even when selecting a pdf driver, like PDF creator or Microsoft's print to pdf driver from Windows? To be honest that's what I used as well, wanted to avoid wasting 65 pages of paper..
Yes, tried it with both virtual (Microsoft's Print to PDF) and physical printers and the problem occurs regardless of which one is used. What bothers me now is why I can't make it crash in XIDE in Debug mode.
User avatar
Chris
Posts: 4606
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by Chris »

Hi Michal,
Michal Rajnoha wrote: Thu Apr 25, 2024 8:46 am
Chris wrote: Thu Apr 25, 2024 8:33 am Thanks for the very good sample, but unfortunately I could not reproduce the problem here, all 65 pages are always printed ok here. Does the problem happen with any printer driver? Even when selecting a pdf driver, like PDF creator or Microsoft's print to pdf driver from Windows? To be honest that's what I used as well, wanted to avoid wasting 65 pages of paper..
Yes, tried it with both virtual (Microsoft's Print to PDF) and physical printers and the problem occurs regardless of which one is used. What bothers me now is why I can't make it crash in XIDE in Debug mode.
Memory corruption issues can be like that, when running through the debugger some memory locations may be different, preventing the underlying problem to expose itself. What OS are you using and what is the .Net Framework version installed? Also since I don't have your email address, can you please send me a short email and I will send you a link to a set of slightly newer RP3 files, they might make a difference as we fixed another issue that could be related recently.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
Michal Rajnoha
Posts: 22
Joined: Wed Sep 29, 2021 6:57 am

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by Michal Rajnoha »

Chris wrote: Thu Apr 25, 2024 9:18 am Memory corruption issues can be like that, when running through the debugger some memory locations may be different, preventing the underlying problem to expose itself. What OS are you using and what is the .Net Framework version installed? Also since I don't have your email address, can you please send me a short email and I will send you a link to a set of slightly newer RP3 files, they might make a difference as we fixed another issue that could be related recently.

We tried it on Windows 11 and Windows 10.
2 PCs where X# is installed and 1 with only redistributables. All have the same issue.
The latest version of .NET Framework we use is 4.8.1.

I will send the email soon.
xor_ag
Posts: 2
Joined: Wed May 29, 2024 11:56 am
Location: Switzerland

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by xor_ag »

Greetings,

We observe the exact same problem. It turns out that printing through the cPrinter class crashes with memory errors whenever we compile Classmate with the "Build/Optimize" flag. It only happens when using the printer DC, print preview is not affected. Disabling Optimize in Release builds (or using Debug builds) stops the crashes.

Is this a compiler bug or a Classmate bug? Is there a known fix?

Code: Select all

Anwendung: WorkSuite.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.AccessViolationException
   bei VOWin32APILibrary.Functions.DrawText(Void*, IntPtr, Int32, VO._winRECT*, UInt32)
   bei Classmate.cHDC.DrawText(System.String, Int32, XSharp.__Float, XSharp.__Float, XSharp.__Float, XSharp.__Float, UInt32)
   bei PP_Server.PrintString(XSharp.__Usual[])
   bei PP_Server.PrintElement(XSharp.__Usual[])
   bei PP_Server.PrintSection(XSharp.__Usual[])
   bei PP_Server.PrintPageBody()
   bei Classmate.cPrinter._PrintPage()
   bei Classmate.cPrinter._PrintDoc()
   bei Classmate.cPrinter._PrintStart()
   bei Classmate.cPrintMsgDialog.OnTimer(Classmate.cEvent)
   bei Classmate.cWindow.Dispatch(Classmate.cEvent)
   bei Classmate.cBaseDialog.Dispatch(Classmate.cEvent)
   bei Classmate_Gui.Functions._cDialogProc(Void*, UInt32, UInt32, Int32)
   bei VOWin32APILibrary.Functions.IsDialogMessage(Void*, VO._winMSG*)
   bei Classmate.cWindow._PreProcessMessage(VO._winMSG*)
   bei Classmate.cDialog._ModalExec()
   bei Classmate.cDialog.Show(Int32)
   bei Classmate.cPrintMsgDialog.Show(Int32)
   bei Classmate.cPrinter.Print()
   bei PP_Server.Print(XSharp.__Usual[])
   bei SQLRuntime.Functions.PPC_Install(XSharp.__Usual[])
   bei DynamicClass.PPC_Install(RTE_L(39),NIL,ARR_Get(RTE_L(14),4),RTE_L(11),RTE_L(12),ARR_Get(RTE_L(14),5))(RTE_L(39),NIL,ARR_Get(RTE_L(14),4),RTE_L(11),RTE_L(12),ARR_Get(RTE_L(14),5))(XSharp.__Usual[])
   bei XSharp.MacroCompiler.UsualMacro.MacroCodeblock.Eval(XSharp.__Usual[])
   bei XSharp.RT.Functions.Eval(XSharp.ICodeblock, XSharp.__Usual[])
   bei XSharp.RT.Functions.MExec(XSharp.Codeblock)
   bei SQLRuntime.Functions.RTE_ExecMacroP(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual)
   bei SQLRuntime.Functions.RTE_Exec(XSharp.__Usual[])
   bei SQLRuntime.Functions.RTE_Func(XSharp.__Usual[])
   bei DynamicClass.RTE_Func("SYS.STDFForm",{"QUOTE","QUOTE_KOPF","QUOTE_HPOS","QUOTENR",DWN_Selected(),""})("SYS.STDFForm",{"QUOTE","QUOTE_KOPF","QUOTE_HPOS","QUOTENR",DWN_Selected(),""})(XSharp.__Usual[])
   bei XSharp.MacroCompiler.UsualMacro.MacroCodeblock.Eval(XSharp.__Usual[])
   bei XSharp.RT.Functions.Eval(XSharp.ICodeblock, XSharp.__Usual[])
   bei XSharp.RT.Functions.MExec(XSharp.Codeblock)
   bei SQLRuntime.Functions.RTE_ExecMacroP(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual)
   bei SQLRuntime.Functions.RTE_Exec(XSharp.__Usual[])
   bei MN_Object.Execute(XSharp.__Usual[])
   bei MN_Object.mnuODIExec(XSharp.__Usual[])

Ausnahmeinformationen: System.Reflection.TargetInvocationException
   bei System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
   bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
   bei System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   bei XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef, Boolean)
   bei XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef, Boolean)
   bei XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
   bei XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
   bei Classmate.cMenu._ProcessCommandMsg(Classmate.cEvent)
   bei Classmate.cWindow.OnCommand(Classmate.cEvent)
   bei WN_Dialog.OnCommand(Classmate.cEvent)
   bei Classmate.cWindow.Dispatch(Classmate.cEvent)
   bei Classmate.cBaseDialog.Dispatch(Classmate.cEvent)
   bei WN_Dialog.Dispatch(Classmate.cEvent)
   bei Classmate_Gui.Functions._cDialogProc(Void*, UInt32, UInt32, Int32)
   bei VOWin32APILibrary.Functions.IsDialogMessage(Void*, VO._winMSG*)
   bei WN_Dialog._PreProcessMessage(VO._winMSG*)
   bei Classmate.cApp.Exec()
   bei cWorkSuite.Start(XSharp.__Usual[])

Ausnahmeinformationen: System.Reflection.TargetInvocationException
   bei System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
   bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
   bei System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   bei XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef, Boolean)
   bei XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef, Boolean)
   bei XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
   bei XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
   bei Classmate_Gui.Functions.CmStart(XSharp.__Symbol)
   bei WorkSuite.Exe.Functions.Start()
User avatar
Chris
Posts: 4606
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by Chris »

I am afraid that building without the optimize flag is the only solution for now, that fixed the problem Michal reported, too. Unfortunately so far we haven't been able to reproduce the problem locally, so it is very difficult to find what's causing it.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
xor_ag
Posts: 2
Joined: Wed May 29, 2024 11:56 am
Location: Switzerland

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by xor_ag »

Chris wrote: Thu Apr 25, 2024 9:18 am a set of slightly newer RP3 files, they might make a difference as we fixed another issue that could be related recently.

Hi Chris,

do these have changes within Classmate Gui? Maybe we should try that fix?
User avatar
Chris
Posts: 4606
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Post by Chris »

xor_ag wrote: Thu May 30, 2024 2:53 pm
Chris wrote: Thu Apr 25, 2024 9:18 am a set of slightly newer RP3 files, they might make a difference as we fixed another issue that could be related recently.

Hi Chris,

do these have changes within Classmate Gui? Maybe we should try that fix?
This didn't fix Michal's problem unfortunately, but it's still worth a try. Please open the file \Classmate, Gui\Printer\Printer, Printer.prg

and change the code in METHOD _PrintDoc() from

Code: Select all

LOCAL dAbort							AS _AbortProc32Delegate
LOCAL pAbort							AS IntPtr

dAbort := _AbortProc32Delegate{ NULL, @_AbortProc32() }
pAbort := Marshal.GetFunctionPointerForDelegate( (System.Delegate) dAbort )
to

Code: Select all

STATIC LOCAL dAbort := _AbortProc32Delegate{ NULL, @_AbortProc32() }							AS _AbortProc32Delegate
STATIC LOCAL pAbort := Marshal.GetFunctionPointerForDelegate( (System.Delegate) dAbort )		AS IntPtr
This keeps the values in the locals always alive and prevents the garbage collector from collecting them, which was causing some other issues.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply