xsharp.eu • ReportPro 3.60 for XSharp 2.60 memory exception
Page 1 of 2

ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 5:40 am
by Michal Rajnoha
Greetings XSharp developers.

We've encountered some sort of memory exception when printing from ReportPro3:

Application: ReportPro3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at ReportPro3_Designer.Functions.ExtTextOut(Void*, Int32, Int32, UInt32, Void*, Void*, UInt32, Int32*)
at ReportPro3_Designer.Functions$DrawFormattedText$.MyExtTextOut(Void*, Int32, Int32, UInt32, VO._winRECT*, Void*, Int32, Int32*)
at ReportPro3_Designer.Functions$DrawFormattedText$._DFTTabbedTextOut(Classmate.cHDC, ReportPro3.DrawFormattedTextStruct*, Int32, Int32)
at ReportPro3_Designer.Functions$DrawFormattedText$._DFTPrintText(Classmate.cHDC, ReportPro3.DrawFormattedTextStruct*)
at ReportPro3_Designer.Functions.DrawFormattedText(Classmate.cHDC, ReportPro3.DrawFormattedTextStruct*)
at ReportPro3.rpField.Print(ReportPro3.rpPrinter, Int32, Int32, Int32, Boolean, System.String)
at ReportPro3.rpSection.PrintBand(ReportPro3.rpBand, Boolean)
at ReportPro3.rpSection.PrintPageBody(Classmate.cPrinter)
at ReportPro3.rpReport.PrintPageBody()
at Classmate.cPrinter._PrintPage()
at Classmate.cPrinter._PrintDoc()
at Classmate.cPrinter._PrintStart()
at Classmate.cPrintMsgDialog.OnTimer(Classmate.cEvent)
at Classmate.cWindow.Dispatch(Classmate.cEvent)
at Classmate.cBaseDialog.Dispatch(Classmate.cEvent)
at Classmate_Gui.Functions._cDialogProc(Void*, UInt32, UInt32, Int32)
at VOWin32APILibrary.Functions.IsDialogMessage(Void*, VO._winMSG*)
at Classmate.cWindow._PreProcessMessage(VO._winMSG*)
at Classmate.cDialog._ModalExec()
at Classmate.cDialog.Show(Int32)
at Classmate.cPrintMsgDialog.Show(Int32)
at Classmate.cPrinter.Print()
at ReportPro3.rpReport.Print()
at ReportPro3.rpDesigner.Menu_Print()

Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
at XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
at Classmate.cMenu._ProcessCommandMsg(Classmate.cEvent)
at Classmate.cToolbar._ProcessCommandMsg(Classmate.cEvent)
at Classmate.cWindow.OnCommand(Classmate.cEvent)
at ReportPro3.rpDesigner.OnCommand(Classmate.cEvent)
at Classmate.cWindow.Dispatch(Classmate.cEvent)
at Classmate.cMDIChild.Dispatch(Classmate.cEvent)
at Classmate_Gui.Functions._cMDIChildProc(Void*, UInt32, UInt32, Int32)
at VOWin32APILibrary.Functions.DispatchMessage(VO._winMSG*)
at Classmate.cApp.Exec()
at ReportPro3.cAppEx.Start()

Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
at XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
at Classmate_Gui.Functions.CmStart(XSharp.__Symbol)
at ReportPro3.Exe.Functions.Start()


This exception occurs when the report is already rendered and sent to print, and it happens randomly usually on pages above 10 around 70-90% of the time even with the most simple reports with just one field in the body.
We're not sure what is going on since we stumbled upon this problem only last week. We've tried it on 3 different PCs and the problem occurs on all of them.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 8:38 am
by Chris
Hi Michal,

Is it possible to reproduce the problem in a small standalone app? If yes, can you please send it together with all needed files (rpt, dbfs etc) to have a look?

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 9:08 am
by Michal Rajnoha
I managed to reproduce it inside ReportPro3 itself.

I've created an SQL table with a single integer column and populated the table with at least 1000 rows.
Then I created a new report (A4 format, metric system, portrait/landscape doesn't matter) and added a single field inside the body with binding to the SQL column.

Now when I enter the print menu ("Print the report" button or "File -> Print"), set a printer and press "OK", it starts the process of printing, showing sent page count. Then it randomly may crash on any given page with the aforementioned exception.

Note that this happens with both physical and virtual printers.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 9:13 am
by Chris
Hi Michal,

Is that only with SQL tables? Can you please check if you get the same also with dbfs?

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 9:39 am
by Michal Rajnoha
Back when we started with ReportPro3 X#, we never managed to make it run with DBFs. Trying to add a DBF section ends with following exception:

Application: ReportPro3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: XSharp.Error
at XSharp.RDD.RddError.PostArgumentError(System.String, UInt32, System.String, UInt32, System.Object[])
at XSharp.CoreDb+<>c__DisplayClass113_0.<UseArea>b__0()
at XSharp.CoreDb.Do[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<Boolean>)
at XSharp.CoreDb.UseArea(Boolean, System.String, System.String, System.String, Boolean, Boolean)
at ReportPro3_Rdd.Functions.OpenRDDTable(Boolean, System.String, System.String, System.String, Boolean, Boolean, Boolean)
at ReportPro3_Rdd.Functions.OpenRDDTableValid(Classmate.cWindow, System.String, System.String)
at ReportPro3.rpRDDTable+<>c__DisplayClass79_0.<SelectSource>b__0(XSharp.__Usual, XSharp.__Usual)
at <>f__AnonymousType3.Eval(XSharp.__Usual[])
at XSharp.RT.Functions.Eval(XSharp.ICodeblock, XSharp.__Usual[])
at XSharp.RT.Functions.Eval(XSharp.__Usual, XSharp.__Usual[])
at ReportPro3.rpOpenTableDlg.OnNotify(Classmate.cControlNotifyEvent)
at Classmate.cWindow.Dispatch(Classmate.cEvent)
at Classmate.cBaseDialog.Dispatch(Classmate.cEvent)
at Classmate_Gui.Functions._CommonFileDlgProc(Void*, UInt32, UInt32, Int32)
at VOWin32APILibrary.Functions.GetOpenFileName(VO._WINOPENFILENAME*)
at Classmate.cOpenFileDialog.Show(Int32)
at ReportPro3.rpRDDTable.SelectSource(Classmate.cWindow, System.String, System.String, System.String, XSharp.__Array)
at ReportPro3.rpDataSource.AddTable(Classmate.cWindow, System.String, ReportPro3.rpRDDTable, XSharp.__Array)
at ReportPro3.rpDataSource.Menu_AddTable(XSharp.__Usual[])

Exception Info: XSharp.Error
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
at XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
at ReportPro3.rpSectionCfgDlg.Menu_Select(XSharp.__Usual[])

Exception Info: XSharp.Error
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.Reflection.MethodInfo, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.SendHelper(System.Object, System.String, XSharp.__Usual[], XSharp.__Usual ByRef)
at XSharp.RT.OOPHelpers.DoSend(System.Object, System.String, XSharp.__Usual[], System.String)
at XSharp.RT.Functions.Send(XSharp.__Usual, XSharp.__Usual, XSharp.__Usual[])
at Classmate.cMenu._ProcessCommandMsg(Classmate.cEvent)
at Classmate.cPopupMenu.ShowAsPopup(Classmate.cWindow, Classmate.cPoint)
at ReportPro3.rpSectionCfgDlg.OnContextMenu(Classmate.cEvent)
at Classmate.cWindow.Dispatch(Classmate.cEvent)
at Classmate.cBaseDialog.Dispatch(Classmate.cEvent)
at Classmate_Gui.Functions._cDialogProc(Void*, UInt32, UInt32, Int32)


Since we were already drifting away from using DBFs, we didn't bother and just went straight to SQL tables.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 9:40 am
by Chris
Michal,

Which exact RP3 version are you using?

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 10:46 am
by Michal Rajnoha
It's this one: ReportPro 3.60 for XSharp 2.60

Now I'm thinking, our X# version is 2.13, so we should be using ReportPro 3.54 for XSharp 2.10?

If that's the case, then there is a different exception it gives at start:

Application: ReportPro3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
at ReportPro3.Exe.Functions.Start()

I guess it may be looking for X# runtime, but even if I copy it into the ReportPro3 folder, it still throws the same exception, while 3.60 starts normally even without the X# runtime being in the same folder.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Tue Apr 23, 2024 10:57 am
by Chris
Hi Michal,

Those RP3 errors seem very strange to me, can't explain them easily, maybe there's some kind of dll hell. In any case, X# 2.13 is very old, released almost 2 years ago I think, so it's much better to install a newer version. Not sure if this will fix the problems, but it's quite possible. Using RP3.6 is fine.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Thu Apr 25, 2024 7:50 am
by Michal Rajnoha
Upgraded to X# 2.18, new findings:

- I managed to make ReportPro3 run with DBFs - we simply tried to push a CDX dbf into a report which expected MDX, so that's on us.

- The exception happens regardless of what type of data source is used.

- The exception happens when printing directly from ReportPro3 itself.

- The exception doesn't ever happen when the application is run in Debug mode in XIDE, but it does when run in Release or directly.

Attached samples for testing.

Re: ReportPro 3.60 for XSharp 2.60 memory exception

Posted: Thu Apr 25, 2024 8:33 am
by Chris
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..