darknessomi / darknessomi/excellibrary

Unintuitive exception thrown for Excel 5.0/95 format worksheets

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
C#
Stars
22
Forks
8
PR merge metrics
No merged PRs in 30d

Description

```
Steps to Reproduce:
1. Save an Excel worksheet using the format Microsoft Excel 5.0/95
2. Provide the path to that worksheet to DataSetHelper.CreateDataSet()
3. An ArgumentNullException is thrown from System.IO.MemoryStream.

There isn't much reason for excellibrary to support such an old format, but a
better error message might be useful. Is it possible to determine whether the
file is in the correct format? If so, perhaps the code could throw some more
specific Exception?

I'm using code checked out from the current trunk (r53).

Full StackTrace:
at System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable)
at System.IO.MemoryStream..ctor(Byte[] buffer)
at ExcelLibrary.SpreadSheet.Workbook.Load(Stream stream)
at ExcelLibrary.SpreadSheet.Workbook.Load(String file)
at ExcelLibrary.DataSetHelper.CreateDataSet(String filePath)
at TestExcelImport.Program.Main(String[] args) in c:\users\theuser\documents\visual studio 2010\Projects\TestExcelImport\TestExcelImport\Program.cs:line 12
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
```

Original issue reported on code.google.com by `etkl...@gmail.com` on 2 Jun 2011 at 6:28

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with an Excel 5.0/95 worksheet, then trace the stack from DataSetHelper.CreateDataSet through Workbook.Load and the MemoryStream constructor. Inspect how the workbook format is read and define a clear failure for this input; done means it no longer exposes the current ArgumentNullException without an understandable explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.