RDLC Report Generation Error in .NET (Visual Studio 2022) – FatalExecutionEngineError

I’m encountering a critical issue while generating RDLC reports in my .NET application. My tech stack includes .NET and Visual Studio 2022. Every time I attempt to generate a report, I receive the following error:

Managed Debugging Assistant ‘FatalExecutionEngineError’
Message=Managed Debugging Assistant ‘FatalExecutionEngineError’ : ‘The runtime has encountered a fatal error. The address of the error was at 0x74688b02, on thread 0x3ed0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.’

This error causes the application to break into debug mode. After debugging, I pinpointed the error to the following line of code within the RenderReportInBackground method:

byte[] bytes = reportViewer.Render(reportFormat, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

Here are the details of the method:

public static byte[] RenderReportInBackground(LocalReport reportViewer, string reportFormat, out string mimeType, out string fileNameExtension)
{
    try
    {
        Warning[] warnings;
        string[] streamIds;
        string encoding;
        string deviceInfo;

        switch (reportFormat.ToUpper())
        {
            case "PDF":
                deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>";
                mimeType = "application/pdf";
                fileNameExtension = "pdf";
                break;
            case "EXCEL":
                deviceInfo = "<DeviceInfo><SimplePageHeaders>False</SimplePageHeaders></DeviceInfo>";
                mimeType = "application/vnd.ms-excel";
                fileNameExtension = "xlsx";
                break;
            default:
                deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>";
                mimeType = "application/pdf";
                fileNameExtension = "pdf";
                break;
        }

        return reportViewer.Render(reportFormat, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streamIds, out warnings);
    }
    catch (Exception ex)
    {
        ex.WriteLog();
        mimeType = "application/pdf";
        fileNameExtension = "";
        return new byte[0];
    }
}

Development Environment:

  1. Visual Studio 2022
  2. .NET Framework 4.8
  3. RDLC Report Designer V15.3.1

Error Context:

The error occurs during the report generation process.
The error points to a potential issue with the CLR or unsafe code portions.
The error code is 0xc0000005.

Troubleshooting Steps Taken:

  • Verified that all necessary NuGet packages are up-to-date.
  • Checked for any issues in the RDLC report definition.
  • Confirmed that the LocalReport object is properly initialized and configured.
  • Open the properties for the project, go to the Build tab and check the Allow unsafe code checkbox.

Despite these efforts, the issue persists. Can someone please provide guidance on how to resolve this error? Are there specific debugging steps or tools I should use to diagnose the root cause?

Thank you for your assistance!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật