You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting this random error System.IO.InvalidDataException: End of Central Directory record could not be found. at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory() at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding) at ExcelDataReader.Core.ZipWorker..ctor(Stream fileStream) at ExcelDataReader.ExcelOpenXmlReader..ctor(Stream stream) at ExcelDataReader.ExcelReaderFactory.CreateReader(Stream fileStream, ExcelReaderConfiguration configuration)
Below is part of the code where the error happens:
` Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Stream stream = await GetFTPFile(_ftp_UrlAndFilename, _ftp_username, _ftp_password);
try
{
using var reader = ExcelReaderFactory.CreateReader(stream);
DataSet ds = reader.AsDataSet(new ExcelDataSetConfiguration()
{
ConfigureDataTable = (tableReader) => new ExcelDataTableConfiguration()
{
UseHeaderRow = true
}
});
foreach (DataColumn column in ds.Tables[0].Columns)
{
if (column.ColumnName.Contains(""))
column.ColumnName = column.ColumnName.Replace(" ", "");
}
return ds.Tables[0].ToList<SellerCloudInventory>();
}
catch (Exception ex)
{
throw new Exception($"There was a problem converting the inventory file from an excel file. The stream length was {stream.Length}.", ex);
}`
I'm pretty sure that the file we're reading is xlsx file. The error sometimes happens and sometimes don't.
Any help please? :) Thanks!
The text was updated successfully, but these errors were encountered:
I'm getting this random error
System.IO.InvalidDataException: End of Central Directory record could not be found. at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory() at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding) at ExcelDataReader.Core.ZipWorker..ctor(Stream fileStream) at ExcelDataReader.ExcelOpenXmlReader..ctor(Stream stream) at ExcelDataReader.ExcelReaderFactory.CreateReader(Stream fileStream, ExcelReaderConfiguration configuration)
Below is part of the code where the error happens:
` Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
I'm pretty sure that the file we're reading is xlsx file. The error sometimes happens and sometimes don't.
Any help please? :) Thanks!
The text was updated successfully, but these errors were encountered: