Page 1 of 1

Weird Error on Deployed Report System.Drawing.dll

Posted: Sun Feb 07, 2016 1:01 am
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?

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

Posted: Mon Feb 08, 2016 7:51 am
by HighAley
Hello.

Sorry, but we couldn't find the image.

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

Thank you.

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

Posted: Mon Feb 08, 2016 2:01 pm
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();

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

Posted: Tue Feb 09, 2016 1:28 pm
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.

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

Posted: Tue Feb 09, 2016 9:39 pm
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

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

Posted: Wed Feb 10, 2016 3:34 am
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;

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

Posted: Wed Feb 10, 2016 11:35 am
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.

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

Posted: Wed Feb 10, 2016 2:00 pm
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.

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

Posted: Thu Feb 11, 2016 2:42 pm
by HighAley
Hello.

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

Code: Select all

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