Null reference exception

Stimulsoft Reports.NET discussion
Post Reply
Defkon1
Posts: 3
Joined: Fri Feb 15, 2008 10:53 am
Location: Italy

Null reference exception

Post by Defkon1 »

Hello. I'm evaluating StiReports [2007.3] for an enterprise project, but i've a small problem with it.

i've embedded your engine report in a MDI form with Office2007 ribbonbar instead of a strip toolbar, with the following code:

Code: Select all

            Stimulsoft.Report.StiReport newReport = new Stimulsoft.Report.StiReport();
            this.newReport.AutoLocalizeReportOnRun = true;
            SqlConnection connection = new SqlConnection(myConnectionString);

            this.newReport.RegData("myConnectionSource", connection);

            this.newReport.Dictionary.Synchronize();
           
            newReport.Design(this);
the designer opens and works correctly as child form, but without the main menu bar (File,...).

On closing the designer form, the following exception is thrown:


System.NullReferenceException

Source=Stimulsoft.Report

StackTrace:
in Stimulsoft.Report.Design.Toolbars.StiToolbarService.GetToolbarServices(StiDesigner designer)
in Stimulsoft.Report.Design.StiToolbarOrderHelper.OrderToolbars(StiDesigner designer)
in Stimulsoft.Report.Design.StiDesigner.OnOrderToolbarsClick(Object sender, EventArgs e)
in Stimulsoft.Report.Design.StiDesigner.InvokeOrderToolbars()
in Stimulsoft.Report.Design.StiDesigner.OnSizeChanged(EventArgs e)
in System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
in System.Windows.Forms.Control.UpdateBounds()
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ScrollableControl.WndProc(Message& m)
in System.Windows.Forms.ContainerControl.WndProc(Message& m)
in System.Windows.Forms.Form.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
how to avoid/fix it?

thanks in advance...
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Null reference exception

Post by Edward »

Unfortunately we couldn't reproduce the issue you've mentioned.

Please try to reset settings to its default state (in a very beginning of your Application, before the forms/controls were been created)

Code: Select all

StiConfig.Restore();
StiConfig.Save();
If this not helps, please send a test application to support[at]stimulsoft.com for analysis.

P.S.
In case of the MDI application, also StiDesignerControl could be used.

Your code in this case would be something as follows:

Code: Select all

StiDesignerControl myDesignerControl = new StiDesignerControl(newReport);
Form myForm = new Form();
myForm.MdiParent = myParentForm;
myForm.Controls.Add(myDesignerControl);
myDesignerControl.Dock = DockStyle.Fill;
myForm.Show();
Defkon1
Posts: 3
Joined: Fri Feb 15, 2008 10:53 am
Location: Italy

Null reference exception

Post by Defkon1 »

Edward wrote:Unfortunately we couldn't reproduce the issue you've mentioned.

Please try to reset settings to its default state (in a very beginning of your Application, before the forms/controls were been created)

Code: Select all

StiConfig.Restore();
StiConfig.Save();
If this not helps, please send a test application to support[at]stimulsoft.com for analysis.
this not helps...

i'm using the Krypton Ribbon Form as MDI form ( http://www.componentfactory.com/products.php ) and i think that the problem is due to the use of a ribbonbar instead of a normal toolbar... what do you think?
P.S.
In case of the MDI application, also StiDesignerControl could be used.

Your code in this case would be something as follows:
[...]
i tried the following code:

Code: Select all


            StiDesigner designer = new StiDesigner(newReport);
            
            designer.MdiParent = this;

            designer.Report = newReport;
            designer.Show();

but same result... i'll try to add programmatically the control as you suggest...
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Null reference exception

Post by Edward »

Could you send a test application to support[at]stimulsoft.com for analysis, please.

Thank you.
Defkon1
Posts: 3
Joined: Fri Feb 15, 2008 10:53 am
Location: Italy

Null reference exception

Post by Defkon1 »

with the following code:

Code: Select all


            Stimulsoft.Report.StiReport newReport = new Stimulsoft.Report.StiReport();
            
            SqlConnection connection = new SqlConnection(myConn);

            newReport.RegData("MyConn", connection);

            newReport.Dictionary.Synchronize();                     

            StiDesignerControl myDesignerControl = new StiDesignerControl(newReport);

            KryptonForm myForm = new KryptonForm();
            myForm.MdiParent = this;
            myForm.Controls.Add(myDesignerControl);
            myDesignerControl.Dock = DockStyle.Fill;
            myForm.Show();

the designer is correctly shown with all toolbars... but i've a small problem while editing the preview...

i'll check my code, because i can't reproduce the error in another app... maybe some code is in conflict with reporting...

thanks for the support, i'll inform you asap
Post Reply