Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.OutOfMemoryException when generating excel with SAX from very large sql result #6

Open
swidz opened this issue Oct 25, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@swidz
Copy link
Owner

swidz commented Oct 25, 2023

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
at System.Xml.XmlUtf8RawTextWriter.WriteAttributeTextBlock(Char* pSrc, Char* pSrcEnd)
at System.Xml.XmlUtf8RawTextWriter.WriteString(String text)
at System.Xml.XmlWellFormedWriter.WriteString(String text)
at DocumentFormat.OpenXml.OpenXmlPartWriter.WriteStartElement(OpenXmlElement elementObject, IEnumerable1 attributes, IEnumerable1 namespaceDeclarations)
at Sql2Xls.Excel.Adapters.ExcelExportSAXAdapter.CreateSharedStringCellSAX(OpenXmlWriter openXmlWriter, Int32 columnIndex, Int32 rowIndex, String value, UInt32 styleIndex, Boolean isValueSharedString) in D:\projects\Sql2Xls\src\Sql2Xls\Excel\Adapters\ExcelExportSAXAdapter.cs:line 422
at Sql2Xls.Excel.Adapters.ExcelExportSAXAdapter.CreateSheetDataSAX(OpenXmlWriter openXmlWriter, DataTable dataTable) in D:\projects\Sql2Xls\src\Sql2Xls\Excel\Adapters\ExcelExportSAXAdapter.cs:line 333
at Sql2Xls.Excel.Adapters.ExcelExportSAXAdapter.CreateWorksheet(SpreadsheetDocument document, WorksheetPart worksheetPart, DataTable dataTable) in D:\projects\Sql2Xls\src\Sql2Xls\Excel\Adapters\ExcelExportSAXAdapter.cs:line 298
at Sql2Xls.Excel.Adapters.ExcelExportAdapter.CreateFromDataTable(SpreadsheetDocument document, DataTable dataTable) in D:\projects\Sql2Xls\src\Sql2Xls\Excel\Adapters\ExcelExportAdapter.cs:line 204
at Sql2Xls.Excel.Adapters.ExcelExportAdapter.LoadFromDataTable(DataTable dataTable) in D:\projects\Sql2Xls\src\Sql2Xls\Excel\Adapters\ExcelExportAdapter.cs:line 96
at Sql2Xls.Sql2XlsService.CreateDocument(String datasetName, String sqlCommand, String outputFile, Sql2XlsServiceParameters parms) in D:\projects\Sql2Xls\src\Sql2Xls\Sql2XlsService.cs:line 181
at Sql2Xls.Sql2XlsService.ProcessTask(Sql2XlsTaskData taskData, Sql2XlsServiceParameters parms) in D:\projects\Sql2Xls\src\Sql2Xls\Sql2XlsService.cs:line 135

@swidz swidz self-assigned this Oct 25, 2023
@swidz swidz added the bug Something isn't working label Oct 25, 2023
@swidz
Copy link
Owner Author

swidz commented Oct 25, 2023

swidz added a commit that referenced this issue Oct 31, 2023
@swidz
Copy link
Owner Author

swidz commented Oct 31, 2023

Unit test added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant