System::AccessViolationError

edited April 2009 in FastReport .NET
Hi!

I have this weird error:
I'm trying to display a report that shows data from a DataTable. The rows in this datatable are inserted from various other datatables. When I click the "print" button the following happens:
- If I move the mouse before the report is displayed everything is OK
- If I don't move the mouse there is about 50% chance that I get a System::AccessViolationError with the following callstack:
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.ToolTip.WndProc(Message& msg)
   at System.Windows.Forms.ToolTip.ToolTipNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(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.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at FastReport.Report.RSAsY14dr(Boolean , Form , Form )
   at FastReport.Report.ShowPrepared(Boolean modal)
   at FastReport.Report.ShowPrepared(

This is the function that calls the ShowPrepared() function
private: System::Void PrintReport(String^ report_name, String^ table_name, DataTable^ dt){
           try{
               Report^ report = gcnew Report();

               report->Load(report_name);

               // register data source
               report->RegisterData(dt, table_name);
               report->GetDataSource(table_name)->Enabled = true;

               // set the databands datasource so it iterates trough all entries
               DataBand^ db1 = (DataBand^)report->FindObject("Data1");
               db1->DataSource = report->GetDataSource(table_name);
               
               if(report->Prepare())report->ShowPrepared();
             }
             catch(Exception^ ex){LOGEX(ex);}
           }

Seems kind of weird that a ToolTip throws the exception when the mouse doesn't move ... Any ideas?

EDIT: This ONLY happens with DataTables that are constructed "by hand" - the rows are inserted one by one. The datatables that are filled with queries to the DB work fine.

Comments

  • edited 9:44AM
    Hello,

    Do you have an example that I can run and test?
  • edited April 2009
    Sorry, the whole app is way too big to use for an example. I tried to recreate but is really hard (I even made a simple app that fills a datatable from two other but no luck). Is there any way I can put some function in the report code so it looks at the DataTable as it is registered or shown?

    Where is the ToolTip present on the report control, the toolstrip ?

    BTW, the report is indeed created, shown for about a second and then CRASH ...

    EDIT: I am talking about the Preview control of course.
  • edited 9:44AM
    Try to disable standard progress window by setting the FastReport.Utils.Config.ReportSettings.ShowProgress to false. Maybe it will help. If it will not, I need an example to fix the problem.
  • edited 9:44AM
    Hi!

    I am working on a demo app to replicate the bug but its hard since there is data in the database and so on and so on ... I still believe the error is on my side but I thought the exception could help me ...

    I will let you know if i succeed in replicating the error.

    Bye

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.