Skip to Content
0
Former Member
Dec 04, 2014 at 01:44 PM

Exception "Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'." with SP12 version

420 Views

Hello,

With the last version of Crystal Report for visual studio SP12, all our reports stop to work launching the same exception "Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'."

This occurs since We have upgrade to last available version as I told SP12, it happens in all our development computers (Windows 7 Professional 64 bits), and at satge server (Windows Server 2012 - 64 bits), production server is running for now SP10 and the reports works perfectly, it seems something related with SP12 version.

Following KBA-1198587 to export reports our sample code that is producing this error is tge bext:

public System.IO.MemoryStream GenerarReport(MyObject _object)

{

Reports.TestReport reportDocument = new Reports.TestReport();

reportDocument.SetDataSource(GetDataSource(_object));

System.IO.MemoryStream reportDomentMemoryStream = (System.IO.MemoryStream)reportDocument.ExportToStream(ExportFormatType.PortableDocFormat);

reportDocument.Close();

reportDocument.Dispose();

return reportDomentMemoryStream;

}

We are developing in .Net 4.5.2

Any idea how to solve it? A similar issue was reported without solution last year

Thanks