ExportToHttpResponse causeing error

Posted on 2012-08-27
Last Modified: 2012-08-27
I created a report with crystal reports.  I am using ExportToHttpResponse to open the report as an attachment.  

ReportDocument report = new ReportDocument();
report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, filename);

Open in new window

I was walking through the code and receive the below error.

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

The report does open but can't figure out why ExportToHttpResponse is having an error.

Any ideas?
Question by:CipherIS
    LVL 20

    Expert Comment

    Is the code inside a try catch? I guess ExportToHttpResponse  should not be inside a try block
    LVL 1

    Author Comment

    It is in a try/catch that is how I found out it is returning - "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
    LVL 20

    Accepted Solution

    That error occurs whenever a dialog box gets opened and the code is in a try/catch.

    Here since a file is getting opened as attachment it will give that error.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now