New Problem

Stimulsoft Reports.WEB discussion
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


I think I figured it out.

But still getting the 2032 error.

Here's example of my code.


///
/// Default page load.
///
///
///
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bool reportLoaded = SessionManager.ReportLoaded;

if (!reportLoaded)
{
int reportId = 0;

reportId = Convert.ToInt32(UIUtil.FetchEncodedInputString(Request, UIConstants.URLPARAM_REPORT_ID));

SessionManager.CurrentReportID = reportId;

Stimulsoft.Report.StiReport stiReport = new Stimulsoft.Report.StiReport();

LoadReport(stiReport);
}
else
{
Response.Redirect("ConfigureReports.aspx");
}
}
}


///
/// Set the report options and load the report.
///
///
private void LoadReport(Stimulsoft.Report.StiReport report)
{
ReportDesigner.UseCache = true;

Stimulsoft.Report.Web.StiWebDesignerOptions.ModifyDictionary = true;
Stimulsoft.Report.Web.StiWebDesignerOptions.ModifyConnections = true;
Stimulsoft.Report.Web.StiWebDesignerOptions.ModifyVariables = true;

ReportDesigner.Design(report);

}

///
/// Event called to load a report. The report is fetched from the database. Then loaded into the Stimulsoft report.
///
///
///
protected void WebReportDesigner_GetReport(object sender, Stimulsoft.Report.Web.StiWebDesigner.StiGetReportEventArgs e)
{
Stimulsoft.Report.StiReport stiReport = e.Report;

int reportId = SessionManager.CurrentReportID;

if (reportId > 0)
{
// ----------------------------------------------------------------------------------------------------------
// Get the PrestoReport content item and build the report.
// ----------------------------------------------------------------------------------------------------------
SessionManager.ReportLoaded = true;
PrestoReport report = PrestoReportsManager.Instance.GetReport(reportId);

if (report != null)
{
SessionManager.ReportName = report.Name;

SessionManager.ReportSQL = report.SQL;
SessionManager.ReportStoredProc = report.StoredProc;

stiReport.Load(report.ReportFile);

}
}
}


I'm getting the following error.




Object reference not set to an instance of an object.

body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }





Server Error in '/Presto3_1' Application.

Object reference not set to an instance of an object.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:






Line 158: SessionManager.ReportStoredProc = report.StoredProc;
Line 159:
Line 160: stiReport.Load(report.ReportFile);
Line 161:
Line 162: }







Source File: C:\Presto3_1\WebApps\Mercury\configure\Reports\EditReports.aspx.cs    Line: 160


Stack Trace:






[NullReferenceException: Object reference not set to an instance of an object.]
Inmagic.Mercury.WebApps.Mercury.configure.reports.EditReports.WebReportDesigner_GetReport(Object sender, StiGetReportEventArgs e) in C:\Presto3_1\WebApps\Mercury\configure\Reports\EditReports.aspx.cs:160
Stimulsoft.Report.Web.StiWebDesigner.OnGetReport(StiGetReportEventArgs e) +28
Stimulsoft.Report.Web.StiWebDesigner.InvokeGetReport() +40
Stimulsoft.Report.Web.StiWebDesigner.OnInit(EventArgs e) +724
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378










Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082








Now here's the weird thing....After I get the error I click OK....A blank report is loaded. I then Exit out of the report...only it doesn't exit...Instead the loads the report just fine.


Mike
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


Just wanted to emphasize. This does NOT happen ALL the time. About 50% of the time.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

New Problem

Post by Vladimir »

Hello, Mike

Please try the following code:

Code: Select all

protected void WebReportDesigner_GetReport(object sender, Stimulsoft.Report.Web.StiWebDesigner.StiGetReportEventArgs e)
{
    Stimulsoft.Report.StiReport stiReport = new Stimulsoft.Report.StiReport();

    int reportId = SessionManager.CurrentReportID;
    if (reportId > 0)
    {
        // ----------------------------------------------------------------------------------------------------------
        // Get the PrestoReport content item and build the report.
        // ----------------------------------------------------------------------------------------------------------
        SessionManager.ReportLoaded = true;
        PrestoReport report = PrestoReportsManager.Instance.GetReport(reportId);

        if (report != null)
        {
            SessionManager.ReportName = report.Name;
            SessionManager.ReportSQL = report.SQL;
            SessionManager.ReportStoredProc = report.StoredProc;

            stiReport.Load(report.ReportFile);

            e.Report = stiReport;
        }
    }
}
Thank you.
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


Well it seems to be working. Been testing for two days now.

THANK YOU.

I would also like to say..I've been very impressed with the product and with the support I've been getting. It's a nice change to work with a very responsible company who seems to actually be concerned with their customer satisfaction. Unfortunately many software companies I've dealt with have not been this responsive.

Thank you again...This is truly an excellent product.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

New Problem

Post by Vladimir »

Hello, Mike

Thank you very much for the feedback. Our company is very carefully tries to help our customers. And will keep on doing this. Customer satisfaction is our priority.

Thank you!
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


New twist with this problem.


First off...it runs PERFECTLY on my machine. Just now having problems when we deployed it to testing.

No error is ever thrown...but the same symptoms as the 2032 error....can't load an existing report from code or create a new report and preloading a dataset.

And the problem ONLY OCCURS WITH IE. Works perfectly well with Firefox.


I installed the release version on my computer and getting the same error problem. But if someone connects to development version...it works GREAT...no matter what browser you use.

Any ideas what may be causing this problem. Our IT guys and I are stumped.


One last thing...I was able to prove that the Get_Report event is NEVER being called with IE.

Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

New Problem

Post by Vladimir »

Hello, Mike
One last thing...I was able to prove that the Get_Report event is NEVER being called with IE.
Do you set the UseCache property to false?

Thank you.
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


NO..I set UseCache = true.

Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

New Problem

Post by Vladimir »

Hello, Mike

Please set the UseCache property to false. Does the GetReport event is called in this case? Does the error disappear with loading a report?

Thank you.
MikeD
Posts: 86
Joined: Fri Feb 12, 2010 4:23 pm
Location: USA

New Problem

Post by MikeD »


UseCache = false didn't help.

I did rewrite my code...to ensure that the GetReport method was in fact being called.

I also added some Logging.

The Logging shows that GetReport is being called.

Here the GetReport Code.

///
/// Event called to load a report. The report is fetched from the database. Then loaded into the Stimulsoft report.
///
///
///
protected void WebReportDesigner_GetReport(object sender, Stimulsoft.Report.Web.StiWebDesigner.StiGetReportEventArgs e)
{
try
{
StringBuilder msg = new StringBuilder();
msg.AppendLine("GetReport");

LoggingFacade.WriteDebugTrace(msg);

Stimulsoft.Report.StiReport stiReport = new Stimulsoft.Report.StiReport();

int reportId = SessionManager.CurrentReportID;

if (reportId > 0)
{
// ----------------------------------------------------------------------------------------------------------
// Get the PrestoReport content item and build the report.
// ----------------------------------------------------------------------------------------------------------
SessionManager.ReportLoaded = true;
PrestoReport report = PrestoReportsManager.Instance.GetReport(reportId);

if (report != null)
{
SessionManager.ReportName = report.Name;

string sql = ReportHelper.Instance.ReformatSQLCommand(report.SQL);

SessionManager.ReportSQL = sql;
SessionManager.ReportStoredProc = report.StoredProc;

msg = new StringBuilder();
msg.AppendLine("Report.Load");

LoggingFacade.WriteDebugTrace(msg);

msg = new StringBuilder();
msg.AppendLine("Reportfile Size : " + report.ReportFile.Count().ToString());

LoggingFacade.WriteDebugTrace(msg);

stiReport.Load(report.ReportFile);

e.Report = stiReport;
}
}
}
catch (Exception ex)
{
string msg = String.Format("Failed to save Report");
throw new InmagicSystemException(msg, ex);
}
}


Here is what was logged.

Presto user: admin
--------------------------------------------------------
Timestamp: Thu, 20 May 2010 15:31:58 GMT (05/20/2010 11:31:58)
Category: Debug Trace; Priority: 1; Severity: Information Process: c:\windows\system32\inetsrv\w3wp.exe
Message: GetReport

Presto user: admin
--------------------------------------------------------
Timestamp: Thu, 20 May 2010 15:31:58 GMT (05/20/2010 11:31:58)
Category: Debug Trace; Priority: 1; Severity: Information Process: c:\windows\system32\inetsrv\w3wp.exe
Message: Report.Load

Presto user: admin
--------------------------------------------------------
Timestamp: Thu, 20 May 2010 15:31:58 GMT (05/20/2010 11:31:58)
Category: Debug Trace; Priority: 1; Severity: Information Process: c:\windows\system32\inetsrv\w3wp.exe
Message: Reportfile Size : 10087

The file size of the report is correct.


Mike

Post Reply