Object reference not set to an instance

Stimulsoft Reports.WEB discussion
Post Reply
Shaheen
Posts: 6
Joined: Thu Aug 17, 2017 8:48 am

Object reference not set to an instance

Post by Shaheen »

Hi,
I am using the StiMobileDesigner component inside an aspx page,

Code: Select all

  <cc2:StiMobileDesigner ID="StiMobileDesigner1" runat="server"
                    onsavereport="StiMobileDesigner1_SaveReport"   Visible="true"
            />
code behind:

Code: Select all

  protected void Page_Load(object sender, EventArgs e)
        {
            if (Page != null && !Page.IsPostBack)
            {
               
                var templateId = Request.QueryString["templateId"];
              
                if (!string.IsNullOrEmpty(templateId))
                {
					TemplayesQuery tQuery = new TemplatesQuery();
                    byte[] templateBody = tQuery.GetTemplateBody(templateId);
                    StiReport report = new StiReport();
                    if (templateBody != null)
                    {
                        report.Load(templateBody);
                       
                    }

                    StiMobileDesigner1.Report = report;

                }
               

            }
        }
sometimes I get the error below (not always and for the same template):
Image
Attachments
attachfilehandler.png
attachfilehandler.png (32.86 KiB) Viewed 5730 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Object reference not set to an instance

Post by HighAley »

Hello.

Could you specify the version of the product?
Do you use multiple servers for your web project? For the work of the designer, the component stores a report object in the server's cache and this error means that the object is lost for some reason. If you use several server instances, we have a solution for this.

Thank you.
Shaheen
Posts: 6
Joined: Thu Aug 17, 2017 8:48 am

Re: Object reference not set to an instance

Post by Shaheen »

Hi,
Thanks for the Reply,
I am using 2016.3.0.0 version, and yes we have two server instances for our web project.

Thanks
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Object reference not set to an instance

Post by HighAley »

Hello.

Please, try to set next static settings:

Code: Select all

this.ReportViewer.UseRelativeUrls=true;
this.ReportViewer.CacheMode = StiCacheMode.Session;
this.ReportViewer.RenderMode = StiRenderMode.AjaxWithCache;
Thank you.
Shaheen
Posts: 6
Joined: Thu Aug 17, 2017 8:48 am

Re: Object reference not set to an instance

Post by Shaheen »

Hi,
I added these lines and we still have the same error:

Code: Select all

  this.StiMobileDesigner.UseRelativeUrls = true;
  this.StiMobileDesigner.CacheMode = StiCacheMode.Session;
Thanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Object reference not set to an instance

Post by Edward »

Hi Shaheen,

Have you tried those properties in the latest version 2017.1.11?

You can download the dlls separately without the complete installation to check that in your project from here: https://www.stimulsoft.com/en/downloads

Thank you,
Edward
Shaheen
Posts: 6
Joined: Thu Aug 17, 2017 8:48 am

Re: Object reference not set to an instance

Post by Shaheen »

Hi,
I updated the dlls and now i am using

Code: Select all

<%@ Register Assembly="Stimulsoft.Report.MobileDesign, Version=2017.1.11.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"
    Namespace="Stimulsoft.Report.MobileDesign" TagPrefix="cc2" %>

Code: Select all

 <cc2:StiMobileDesigner ID="StiMobileDesigner1" runat="server"
                    onsavereport="StiMobileDesigner1_SaveReport"   Visible="true"
            />

Code: Select all

this.StiMobileDesigner1.UseRelativeUrls = true;
                this.StiMobileDesigner1.CacheMode = StiCacheMode.Session;
and I still get the same error.

Regards.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Object reference not set to an instance

Post by Alex K. »

Hello,

We couldn't reproduce this issue.
Could you send us a simple project which reproduces the issue for analysis.

Thank you.
Post Reply