Upgraded to 2014.3.0 ResponseAsPDF Error

Stimulsoft Reports.WEB discussion
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

Since upgrading our ASP.Net website to 2014.3.0, the following code results in an error "[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"

Code: Select all

              var settings = new StiPdfExportSettings()
              {
                UseUnicode = true,
                StandardPdfFonts = false,
                EmbeddedFonts = true
                 
              };
            
              SetLayoutForPrint(rep, rvRequest.ReportParameters);
              
              rep.Render(false);

              // Respond with generated PDF
              StiReportResponse.ResponseAsPdf(this, rep, false, settings);
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

I should have been clearer, it's failing on the ResponseAsPDF call.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by HighAley »

Hello.

Sorry, but we need more information about this error.
Could you send us a full error stack and a sample project that reproduces the issue with step-by-step instruction?

Thank you.
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

Try it yourself.

Create a new ASP.Net website. Add Stimulsoft.Base, Stimulsoft.Report and Stimulsoft.Web dlls as references.

You can see the code I'm using in the attached screenshot.

It shows the stack trace is not being very helpful.
Attachments
ResponseAsPDFError.png
ResponseAsPDFError.png (61.32 KiB) Viewed 4511 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by Alex K. »

Hello,

We couldn't reproduce this bug.
Please send us a sample project with test data for analysis.

Thank you.
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

Here is a test project which reports the error, written in VS2013

I am running on a 64bit PC and IIS is configured to run in non-32bit mode.
Attachments
SSError.zip
(14.56 MiB) Downloaded 653 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by HighAley »

Hello.

Unfortunately, we can't reproduce your issue because you load report from assembly with next code. But there is no such file.

Code: Select all

StiReport rep = StiReport.GetReportFromAssembly(@"C:\Testing\Reports\Standard\Report.mrx");
Furthermore, the mrx-file is not an assembly and it's impossible to use it with this method. Please, read the Storing Reports article.

Also you use next connection string in the report and there is no necessary database to reproduce the issue.

Code: Select all

 rep.Dictionary.Databases.Add(new StiOleDbDatabase("TEST",@"Data Source=localhost;Initial Catalog=MyDB;Integrated Security=False;User ID=userid;Password=password;Provider=OLEDB"));
Please, send us a working sample project which will help us to reproduce your issue.

Thank you.
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

The mrx file is a compiled report, a dll essentially. Surely you have one of those lying around?

The connection string is a made up one because we cannot send you our databases for IP reasons. You can probably ignore this anyway.

The report object gets created ok, but the ResponseAsPDF fails
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by HighAley »

Hello.

Please, try to put the ResponseAsPDF in try-catch.

Code: Select all

        try
        {
            // Respond with generated PDF
            StiReportResponse.ResponseAsPdf(this, rep, false, settings);
        }
        catch(System.Threading.ThreadAbortException ex1)
        {
            // do nothing
            //
        }
The error is not from our side. You could read more information on following links:
http://support.microsoft.com/kb/312629/en-us
https://briancaos.wordpress.com/2010/11 ... g-aborted/

Thank you.
damtur
Posts: 17
Joined: Wed Oct 16, 2013 9:33 pm

Re: Upgraded to 2014.3.0 ResponseAsPDF Error

Post by damtur »

Interesting. That seems to work.

Apologies for wasting your time, but it was odd to us that this used to work fine without errors being thrown and since we upgraded the exception occurred.

Thanks for the tip.
Post Reply