FIX: Error message when you export a report to Excel in Report Manager on a server that is running SQL Server 2008: "Unhandled managed exception: Type = System.ArgumentOutOfRangeException"

This article has been archived. It is offered "as is" and will no longer be updated.
Consider the following scenario:
  • You run Report Builder on a server that is running Microsoft SQL Server 2008.
  • You create a report that contains one or more images on each page of the report.
  • You run the report, and then you export the report to Microsoft Excel.
  • The report exceeds 1,023 pages, or the report exceeds a total of 1,023 images that are printed in the report.

In this scenario, the export of the report crashes, and you receive the following error message:
Assert in function = System.IO.FileStream.Write file = line = 0 expression = Unhandled managed exception: Type = System.ArgumentOutOfRangeException, Message = Non-negative number required

Additionally, you receive a call stack error message that resembles the following:
mscorlib_ni!System.IO.FileStream.WriteReportingServicesLibrary!Microsoft.ReportingServices.Library.PartitionFileStream.WriteReportingServicesLibrary!Microsoft.ReportingServices.Library.MemoryUntilThresholdStream.WriteReportingServicesLibrary!Microsoft.ReportingServices.Library.RSStream.WriteMicrosoft_ReportingServices_ExcelRendering!Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelGenerator.BIFF8.Records.MsoDrawingGroup.FillRecordWithBlipsMicrosoft_ReportingServices_ExcelRendering!Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelGenerator.BIFF8.Records.MsoDrawingGroup.WriteToStreamMicrosoft_ReportingServices_ExcelRendering!Microsoft.ReportingServices.Rendering.ExcelRenderer.Excel.BIFF8.BIFF8Generator.WriteGlobalStreamMicrosoft_ReportingServices_ExcelRendering!Microsoft.ReportingServices.Rendering.ExcelRenderer.Excel.BIFF8.BIFF8Generator.SaveSpreadsheetMicrosoft_ReportingServices_ExcelRendering!Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer.RenderReportingServicesService!RsDump,Area Path:\Reporting Services\Report Processing\Rendering\Excel,Iteration PathReportingServicesService!RsDump,Area Path:\Reporting Services\Report Processing\Rendering\Excel,Iteration Path


Service pack information

To resolve this problem, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
968382 How to obtain the latest service pack for SQL Server 2008

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

This problem was first corrected in SQL Server 2008 Service Pack 2 for SQL Server 2008.
For more information about Report Builder in SQL Server 2008, see the following topic on the Microsoft TechNet website:

Article ID: 2216484 - Last Review: 12/12/2015 09:13:38 - Revision: 2.0

Microsoft SQL Server 2008 Enterprise, Microsoft SQL Server 2008 Developer, Microsoft SQL Server 2008 Standard

  • kbnosurvey kbarchive kbinfo kbexpertiseinter kbprb kbtshoot kbsurveynew kberrmsg KB2216484