Hi, Using DataPresenterExcelExporter in 12.1 and throwing an exception when the datapresenter has more than ~136k records.
We're using the ExportAsync Method and when we hit the 136k area, we hit the below exception (tried multiple times and always this area). It's fine exporting 80k records (all attempts are xlsx format). Total data attempting to export is around 200k rows, 25 columns. Is this a known issue?
System.ObjectDisposedException: Can not access a closed Stream. at System.IO.Compression.DeflateStream.EnsureNotDisposed() at System.IO.Compression.DeflateStream.Flush() at MS.Internal.IO.Packaging.CompressStream.Flush() at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Flush() at MS.Internal.IO.Zip.ZipIOLocalFileBlock.FlushExposedStreams() at MS.Internal.IO.Zip.ZipIOLocalFileBlock.UpdateReferences(Boolean closingFlag) at MS.Internal.IO.Zip.ZipIOBlockManager.SaveContainer(Boolean closingFlag) at MS.Internal.IO.Zip.ZipIOBlockManager.SaveStream(ZipIOLocalFileBlock blockRequestingFlush, Boolean closingFlag) at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.Packaging.PackagePart.Close() at System.IO.Packaging.Package.DoClose(PackagePart p) at System.IO.Packaging.Package.DoOperationOnEachPart(PartOperation operation) at System.IO.Packaging.Package.System.IDisposable.Dispose() at Infragistics.Documents.Excel.PackageWrapper.Dispose() at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.Dispose(Boolean disposing) at Infragistics.Documents.Excel.Serialization.WorkbookSerializationManager.System.IDisposable.Dispose() at Infragistics.Documents.Excel.Workbook.SaveXLSXFile(Stream stream, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.SaveHelper(Stream stream, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.Save(String fileName, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.Save(String fileName) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.EndExportInternal(DataPresenterExcelExporterHelper exporterHelper, RecordExportCancellationInfo cancelInfo) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporterHelper.EndExport(RecordExportCancellationInfo cancelInfo) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporterHelper.Infragistics.Windows.DataPresenter.IDataPresenterExporterAsync.CancelExport(RecordExportCancellationInfo cancelInfo) at Infragistics.Windows.DataPresenter.ExportHelper.ExportRequest.CancelExport(RecordExportCancellationReason reason, Exception exception) at Infragistics.Windows.DataPresenter.ExportHelper.ProcessAsyncExportBlock(ExportRequest request) at Infragistics.Windows.DataPresenter.ExportHelper.ProcessAsyncExportBlock() at Infragistics.Windows.DataPresenter.ExportHelper.OnAsyncTimerTick(Object sender, EventArgs e) at System.Windows.Threading.DispatcherTimer.FireTick(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Hello Barry,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation. I tested the same with both the RTM (12.1_20121.1010) and latest Service Release(12.1_20121.2169) of 12.1.
Looking forward for your reply.
We are getting the same error when try to export around 300K rows into a Worksheet.
private static void ExportDSSheet(Worksheet ws, DataPresenterBase dpresenter, int startRowIndex, int startColumnIndex) { Exporter.CellExported += exporter_CellExported; Exporter.Export(dpresenter, ws, startRowIndex, startColumnIndex); <-- this throws the Close stream error
}
Since I don't have your code, I am assuming that the Export() method is utilizing Using() on SteamReader and StreamWriter! as this post suggests
https://stackoverflow.com/questions/10934585/memorystream-cannot-access-a-closed-stream
Exporting to a Workbook seems to be working with the same dataset.
Environment
Runtime version v4.0.30319 of InfragisticsWPF4.DataPresenter.ExcelExporter.v12.1
.Net 4.7
windows 7 Enterprise (service Pack 1)