Weird Error on Deployed Report System.Drawing.dll

Stimulsoft Reports.NET discussion
Post Reply
Batuta
Posts: 11
Joined: Tue Aug 21, 2012 9:18 pm

Weird Error on Deployed Report System.Drawing.dll

Post by Batuta »

I have a web application which generates a report into a PDF format.

On my development machine, it runs properly, the report is being generated as expected.

On the deployed machine, the report is throwing an error:

Image

When I run the application on debug, there was a Stack Overflow exception which happens on System.Drawing.dll.

In my code, the application would specifically hang at this line:

Code: Select all

StiReport appReport = new StiReport();
Sample code as below..

Code: Select all

private void PreviewReport(int FromMonthID, int FromYear,
                                   int ToMonthID, int ToYear,
                                   int ProvinceID, string ReportObject)
        {
            string generatedDate = String.Format("{0:MMMM d, yyyy}", DateTime.Today);
            string dbServer = System.Configuration.ConfigurationManager.AppSettings["DBServer"];
            dbServer = dbServer.Replace(@"\\", @"\");
            string dbDatabase = "Valid Values Here.";
            string dbUser = "Valid Values Here.";
            string dbPassword = "Valid Values Here.";
            string connectionString = "User ID=" + dbUser + ";Initial Catalog=" + dbDatabase + ";Password=" + dbPassword + ";Integrated Security=False;Data Source=" + dbServer;
            string reportMapPath = string.Empty;

            switch (ReportObject.ToUpper())
            {
                case "A":
                    reportMapPath = "reports\\A.mrt";
                    break;
                case "B":
                    reportMapPath = "reports\\B.mrt";
                    break;
                case "C":
                    reportMapPath = "reports\\C.mrt";
                    break;
                case "D":
                    reportMapPath = "reports\\D.mrt";
                    break;
                case "RBYLP":
                    reportMapPath = "reports\\E.mrt";
                    break;
            }

            StiReport appReport = new StiReport();
            appReport.Load(Server.MapPath(reportMapPath));
            appReport.Dictionary.Databases.Clear();
            appReport.Dictionary.Databases.Add(new StiSqlDatabase("WineTracker", connectionString));
            appReport.Compile();
    }
I thought that the System.Drawing.dll is corrupted, hence, I tried to copy the file into the bin folder and make the reference from there, but still I am getting an error.

Anyone encountered this issue?
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Weird Error on Deployed Report System.Drawing.dll

Post by HighAley »

Hello.

Sorry, but we couldn't find the image.

Could you also write the error message with full error stack?

Thank you.
Batuta
Posts: 11
Joined: Tue Aug 21, 2012 9:18 pm

Re: Weird Error on Deployed Report System.Drawing.dll

Post by Batuta »

Here's the image.

Image

I will try to see if I can get the full stack trace. Pretty much it errors out with a StackOverflow Exception on the line of code:

Code: Select all

StiReport appReport = new StiReport();
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Weird Error on Deployed Report System.Drawing.dll

Post by HighAley »

Hello.

Please, try to set next static option:

Code: Select all

Stimulsoft.Report.StiOptions.Engine.FullTrust = false;
Could you also specify which version of our product you use?

Thank you.
Batuta
Posts: 11
Joined: Tue Aug 21, 2012 9:18 pm

Re: Weird Error on Deployed Report System.Drawing.dll

Post by Batuta »

I have the following Stimulsoft DLLs (including version numbers as deployed):



Stimulsoft.Base.dll (2013.2.1700.0) 570 KB

Stimulsoft.Report.dll (2013.2.1700.0) 5.06 MB

Stimulsoft.Report.Web.dll (2013.2.1700.0) 726 KB
Batuta
Posts: 11
Joined: Tue Aug 21, 2012 9:18 pm

Re: Weird Error on Deployed Report System.Drawing.dll

Post by Batuta »

When I set this line of code

Code: Select all

Stimulsoft.Report.StiOptions.Engine.FullTrust = false;
Such that the code becomes like this:

Code: Select all

StiReport appReport = new StiReport();
StiOptions.Engine.FullTrust = false;

I am getting the error: Object reference not set to an instance of an object.

when the value for the parameter of the report's Stored Procedure is being set.

Code: Select all

appReport.CompiledReport.DataSources["proc1"].Parameters["@Param1"].ParameterValue = ParamValue1;
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Weird Error on Deployed Report System.Drawing.dll

Post by HighAley »

Hello.

You should set the static option before initialization of any Stimulsoft component.
Please, set it before creating StiReport object.

Could you also try our latest build? There could be an improvement of this issue.

Thank you.
Batuta
Posts: 11
Joined: Tue Aug 21, 2012 9:18 pm

Re: Weird Error on Deployed Report System.Drawing.dll

Post by Batuta »

Do you mind if I ask what the static option do?

Also, could you show me some code sample where to place it?

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

Re: Weird Error on Deployed Report System.Drawing.dll

Post by HighAley »

Hello.

Please, try to add this option before initialization of components:

Code: Select all

StiOptions.Engine.FullTrust = false;
InitializeComponent();
Thank you.
Post Reply