ENTER key problem

Hello,


This product is very impressive, fast and intelligent, but I found a serious (but hard to reproduce) bug in the report engine. It is not too good for me, because I spent a lot of time developing my reports with this engine, and this bug makes my product very unstable and dangerous.

My software produces invoices with this engine. Normally the invoices are printed correctly, without any problems. But when the user presses ENTER many times before printing, the system falls into an unstable state and prints the invoice again and again. In the background when I tried to debug the program the control did not follow the normal direction, but fell before the print command. At the end, the program died with object reference is not set exception.

And there is a bigger problem: the result. Sometimes a few detail lines are missing from the invoice. The total is correct (it is not calculated by report, the program calculates it before printing from the underlying dataset). It is very dangerous, because in our country the developers are responsible for the rightness of the printed invoices by our software.

The dataset is probably good, at this moment I am using microsoft reporting service to print invoices from this dataset without any problems (the invoice is ugly but correct), and because the business logic and the printing code is separated IMHO this problem is also in the reporting engine.

The reproduction of the bug is very hard, but not impossible:

1.Set the xps printer driver to default printer (it works with any printer, but saves paper)
2.Create an empty windows.forms project.
3.Create an empty dataset with only one datatable with three or more columns
4.Put this dataset and one empty report to main form.
5.Assign the dataset to the report
6.Put a button to the form, and write to the OnClick event button:
report1.PrintSettings.ShowDialog = false;
report1.Print();

And the hard thing: run the program, and press the enter key very fast and many times. When the file dialog appears click the close button and repeat. If you are fast enough (for the 100th or 200th time) you will get the object reference is not set exception.

at FastReport.ReportSettings.Fw4jiBJ8g(Report )
at FastReport.Engine.ReportEngine.HVhp0KjEy(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.PUDha1qOx(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at FastReport.Report.Print()
at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\attila\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 22
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
atSystem.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApplication1.Program.Main() in C:\Users\attila\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


This problem is real, and if this bug is destroyed IMHO will solve the control flowing problem. This problem always appears when the user hits ENTER many times. But I'm not sure about the missing detail lines. Could you give any suggestions about how I could catch this bug ?

Best regards,
Attila Goda

Comments

  • edited July 2009
    Hello,

    I was not able to reproduce this bug even after 15minutes of pressing Enter/Esc keys.
    Hovewer I have some idea why it may happen. When you run some time consuming operations (such as prepare, export, print), FastReport displays the progress window with Cancel button. If you press Enter at this moment, FR will stop the operation - it's the reason why
    wrote:
    Sometimes a few detail lines are missing from the invoice.
    If this behavior is not good for you, you may disable the progress window by setting
    Config.ReportSettings.ShowProgress = false
    before running a report.
  • edited 4:04PM
    AlexTZ wrote: »
    Hello,

    I was not able to reproduce this bug even after 15minutes of pressing Enter/Esc keys.
    Hovewer I have some idea why it may happen. When you run some time consuming operations (such as prepare, export, print), FastReport displays the progress window with Cancel button. If you press Enter at this moment, FR will stop the operation - it's the reason why
    AlexTZ wrote: »
    Sometimes a few detail lines are missing from the invoice.
    If this behavior is not good for you, you may disable the progress window by setting
    Config.ReportSettings.ShowProgress = false
    before running a report.

    AlexTZ wrote: »
    I was not able to reproduce this bug even after 15minutes of pressing Enter/Esc keys.

    You must press the Enter key really fast. Not easy to reproduce it with this program, but with my
    invoice really easy. I don't know why, I tired to create more complex report with more data and it doesn't seems
    easier to reproduce this thing.
    AlexTZ wrote: »
    If this behavior is not good for you, you may disable the progress window by setting
    Config.ReportSettings.ShowProgress = false
    before running a report
    Thank you very mutch - it seems to solve this problem.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.