Page 1 of 1

Object reference not set to an instance

Posted: Thu Aug 17, 2017 10:16 am
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

Re: Object reference not set to an instance

Posted: Thu Aug 17, 2017 3:35 pm
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.

Re: Object reference not set to an instance

Posted: Sun Aug 20, 2017 5:20 am
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

Re: Object reference not set to an instance

Posted: Mon Aug 21, 2017 7:10 pm
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.

Re: Object reference not set to an instance

Posted: Wed Aug 23, 2017 8:08 am
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

Re: Object reference not set to an instance

Posted: Thu Aug 24, 2017 8:45 pm
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

Re: Object reference not set to an instance

Posted: Tue Aug 29, 2017 7:34 am
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.

Re: Object reference not set to an instance

Posted: Wed Aug 30, 2017 9:00 pm
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.