WebViewer Exception


05-20-2009, 6:51 AM
Hello!

I have a WebViewer control on my ASP.NET page to view the report generated from a .rpx file via LoadLayout method. I get a System.NullReferenceException: Object reference not set to an instance of an object. I can not resolve this problem and i need help.
Exception details:

[NullReferenceException: Object reference not set to an instance of an object.] #8Gc.#7Gc.#FHc(String receipt) +700 DataDynamics.ActiveReports.Web.WebViewer.#FHc() +62 DataDynamics.ActiveReports.Web.WebViewer.#xHc(HtmlTextWriter output) +56 DataDynamics.ActiveReports.Web.WebViewer.RenderChildren(HtmlTextWriter output) +744 System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10 System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

I need to resolve this problem verry urgent. So please help me.

Re: WebViewer Exception


05-20-2009, 1:58 PM
Hello Greif,

Could you please provide us some more information or probably the code snippet where you are getting this exception message?
What steps you have taken to load the rpx file in your application? Is your RPX file using any scripting? Which viewer type you are using to display your report and which build of Active Reports for .NET 3.0 is currently installed on your machine?

Any further information provided to isolate the issue would be appreciated.

Regards,
Ankit Nigam

Re: WebViewer Exception


05-21-2009, 12:53 AM
Hello Ankit,

I have attachet the code responible for loading the rpx file and displaying the report.

 AnkitN wrote:
Could you please provide us some more information or probably the code snippet where you are getting this exception message?


That i can not do. Becouse in debuggin of the web site i did not find the code responsible for the exception, acctualy the "Page_Load" event executes to the lest line of code with no problems.

 AnkitN wrote:
What steps you have taken to load the rpx file in your application?


This is the code snippet that loads the rpx:
        try
        {

            main_rpt = new ActiveReport3();
            main_rpt.LoadLayout(RptFileUtil.RPXActualPath(WorkPath, ParameterCollection["ReportName"]));
            main_rpt.AddScriptReference(RptFileUtil.GetRptUtilDllPath());
            main_rpt.Document.Printer.PrinterName = "";
        }
        catch (Exception ex)
        {
            TransferOnException(ex, "Napaka pri nalaganju izpisa!");
        }

 AnkitN wrote:
Is your RPX file using any scripting?


Yes my RPX files are using scripting to load subreports.

 AnkitN wrote:
Which viewer type you are using to display your report and which build of Active Reports for .NET 3.0 is currently installed on your machine?


I am usig ViewerType.AcrobatReader to display my reports. The build of AR currently installed on my machine is 5.2.1013.2

I hope that this information is of help to you.

Re: WebViewer Exception


05-21-2009, 3:21 PM
Hello Greif,

Could you please provide me the RPX file of your report?
You can find information on saving and loading of RPX files over the following link:
http://www.datadynamics.com/Help/ARNET3/ar3tskSavingandLoadingRPXFiles.html
Also as you have mention in your previous post that you were using ViewerType as AcrobatReader, but in the attached sample you have used ViewerType as ActiveXViewer. So could you please confirm me that which ViewerType you are using?
Any further information provided to isolate the issue would be appreciated.

Regards,
Ankit Nigam

Re: WebViewer Exception


05-22-2009, 5:57 AM
Hello

I have managed to isolate the line of code in my ASP.NET web site that generates the above mentioned exception. This code generates the exception:

        main_rpt.Document.Dispose();
        main_rpt.Dispose();
        main_rpt = null;
        ParameterCollection = null;

If i comment the "main_rpt.Document.Dispose();" line i get no exception. If i  uncomment the line then i get the exception.

The .rpx file that i load into the "main_rpt" object is attached.

Hope that that get's as a step forward in solving this issue...


Re: WebViewer Exception


05-22-2009, 8:22 AM
greif,

Report's Document contains the end result of running the report.  So it should only be disposed after you have completed your report viewing, exporting, printing or any other operations.