Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Commented Unassigned: ExcelReaderFactory.CreateBinaryReader fails [12992]

$
0
0
Pretty simple; code is as follows:

FileInfo thisfinfo = Utilities.GetFileInFolderByIndex(1, wipboardreports_folderpath);
FileStream stream = File.Open(thisfinfo.FullName, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);

Fails on line three.

Exception information:
OUTPUT:
"
...
...
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: An item with the same key has already been added.
"

CALL STACK:
"
Excel.4.5.dll!Excel.ExcelBinaryReader.readWorkBookGlobals() Line 244
Excel.4.5.dll!Excel.ExcelBinaryReader.Initialize(System.IO.Stream fileStream) Line 917
Excel.4.5.dll!Excel.ExcelReaderFactory.CreateBinaryReader(System.IO.Stream fileStream) Line 24
Project2.exe!MyTestSystem.Program.Main() Line 48 + 0x9 bytes

"


System information:
OS: Windows 7 64 bit
Compiler: Visual studio default?


Thanks to anyone for your help!
Comments: ** Comment from web user: vDeveloper **

This issue is not coming because of formats dictionary.

It is because of adding logs in LogManager.cs file.
To resolve this issue, put a condition whether key is already present or not at line no. 48 in LogManager.cs file.

if(!_dictionary.ContainsKey(objectName))
_dictionary.Add(objectName, result);

I was facing the same issue and it got resolved with this update.


Viewing all articles
Browse latest Browse all 448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>