Skip to Content
Former Member
Mar 11, 2013 at 03:29 AM

ExportToStream method no longer returns System.IO.MemoryStream in CR 2008 SP5


We updated our Crystal 2008 Runtime from SP3 to SP5 (in attempt to fix the intermittent "invalid printer specified" error). The application is a web service running in IIS. This application has existed in this form for 9 years (started with crystal 8, then 10, then 11.5 r2 then 2008 sp3, now 2008 sp5). It is currently used in 20+ production environments with different platforms (32 & 64 bit), different versions of Windows, Crystal, etc. The same code has always worked fine in all of those instances. As soon as we moved from SP3 to SP5, whenever we make the call to

Dim stream as System.IO.MemoryStream = myReportDocument.ExportToStream(ExportFormatType.PortableDocFormat)

we get the exception: "Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'."

I verified the type of object now being returned by the ExportToStream method, and it is in fact of type FileStreamDeleteOnClose. Why all of a sudden does the ExportToStream method no longer return a memory stream?? Is anyone else experiencing this issue with Crystal 2008 SP5 (or SP4)? Anyone found a solution?


1. We can reproduce this error on our development machine (32 bit Windows Server 2003 SP2 / IIS 5 / .Net 2.0) and on the production machine (64 bit Windows Server 2008 SP2 / IIS 6 / .Net 3.0)

2. When I upgraded the service to VS2010 and ran the service in .Net 4.0, I still see the same problem (ExportToStream method does not return a memory stream), but the type of object returned in thise case is actually of type: CrystalDecisions.ReportSource.EromReportSourceBase.%

3. Our web service runs in a separate app pool with administrator privileges.