Exceptions on loading valid Excel file - every time

Hi,

In the C#/.NET component, upon calling:

new Workbook(fileName);

two exceptions are being thrown and caught every time. These are “Could not read block - no data!” and after that, “Cannot read that as a Zip file”. I have my debugger set to break on any exceptions so I’m aware of these occurring even though they’re being caught.

Even though they’re being caught, throwing and catching exceptions is very slow (compared with other operations) and it should be avoided. Paying this performance cost every single time a file is loaded is not very good design from a performance standpoint (as well as the annoyance of having the debugger break!)

I hope it will be fixed soon as we’re looking to evaluate an Excel interoperability library and are strongly considering Aspose.

Hi,

Please post your template file, we will check it soon.

I have met the exact same problem as MgSam’s and have not got a answer up to now. Looking forward to see the solution to this problem as soon as possible.

var workBook = new Workbook(filePath);


This throws and catches exceptions each time its invoked. I've also found that

workBook.Save(filePath)

is throwing and catching an exception each time its invoked.


This really needs to be addressed. It screws up debugging and is needlessly inefficient.

Hi,


Please attach your template Excel file. If possible, please create a sample console application, zip it and post it here to reproduce the issue on our end with template file.

We will check your issue soon.

Thank you.

I’ve included a project that does nothing other than instantiate a Workbook object and then tries to save it. If you run it with the VS debugger set to break on all exceptions, you will see the issue. It only occurs for xls files, not xlsx, from what I can tell.

Hi,

I have tested your file with the latest version:
Aspose.Cells for .NET v7.0.3.2 and it is working fine.

Please see the code below and the output xls file.

C#


string path = @“F:\Shak-Data-RW\Downloads\AposeCellsProblem\Test.xls”;

Workbook wb = new Workbook(path);

wb.Save(path + “.out.xls”);


I am not able to get the DLL you linked to work at all. It must be built for your specific machine or something else is wrong.

Was this issue actually known about and fixed in a newer build, or you just were not able to replicate the issue?

Hi,

What is the .NET framework version of your System? Are you using .NET framework ClientProfile? In this case, you will need a different dll and not this one.

I’m using Windows 7 64 bit. I did have the test project set to .NET 4.0 Client Profile but I changed it to .NET 4.0 based on your feedback so that I could test this DLL. However, the same exact exceptions still occur.

They are handled exceptions. They are thrown and caught internally in Apose.Cells, every time. I known they are happening because my debugger is set to break whenever an exception is thrown. It doesn’t affect the library from being usable, but it is a serious pain when debugging and its inefficient.

Did you even try to reproduce the problem before telling me it is working fine?

Hi,

Yes, I did test it as you can see the sample code and the output file attached by me. I was not able to reproduce the problem.

It seems, you need ClientProfile dll. We will provide it to you asap.

So is there a resolution?

Hi,

Please try the client profile version of Aspose.Cells dll, which you will find in net3.5_ClientProfile folder and share your feedback with me.

Please download the MSI installer that will create the above folders from this link:
Aspose.Cells for .NET 7.0.3

I tried this and the same exceptions are still thrown (and caught). I strongly suspect these exceptions have nothing to do with the framework version.

Clearly, I am not the only one having this issue, as only a small subset
of users of a product typically post on a forum and this thread has two people encountering it.

Can you please try and project that I uploaded for you to test with and list every step you are taking to reproduce the problem? I’m not sure that you’re understanding what the issue is.

Here is the exception text again:

new Workbook(“myfile.xls”); - causes the following exceptions to be thrown and caught:

ࣝ.დ occurred
Message=Could not read block - no data! (position 0x00000000)
Source=Aspose.Cells
StackTrace:
at ࣝ.Ⴏ._Ⴟ(Stream ݞ, String Ⴠ)
InnerException:

ࣝ.Ⴎ occurred
Message=Cannot read that as a ZipFile
Source=Aspose.Cells
StackTrace:
at ࣝ.ვ.ᅻ(ვ ၧ)
InnerException: ࣝ.დ
Message=Could not read block - no data! (position 0x00000000)
Source=Aspose.Cells
StackTrace:
at ࣝ.Ⴏ._Ⴟ(Stream ݞ, String Ⴠ)
at ࣝ.Ⴏ.Ⴞ(Stream ݞ)
at ࣝ.ვ.ᅽ(Stream ݞ)
at ࣝ.ვ.ᅻ(ვ ၧ)
InnerException:

workbook.Save(“out.xls”) - causes the following exception to be thrown and caught:

System.ArgumentException occurred
Message=Item has already been added. Key in dictionary: ‘0’ Key being added: ‘0’
Source=mscorlib
StackTrace:
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
InnerException:

Hi,

Its strange, your issue is still unresolved.

I have forwarded your thread to our development team. I have also logged this issue in our database. We will look into it and update you asap.

This issue has been logged as CELLSNET-40141.

Hi,


Could you try our latest client profile fixed version (attached): Aspose.Cells for .NET v7.0.3.3 For
.NetClient Profile.

Still gives the same 3 exceptions…

Could you actually try to identify and solve the issue before you tell me it’s fixed? It’s not going to just magically disappear because you have a newer build if you don’t replicate it and discover the cause.

Hi,

You got the clientprofile version because I requested it earlier to provide you a clientprofile version of the dll. As I mentioned, it is weird you are getting the exception and the same code that gives you exception runs on our system. So it is a difficult problem to reproduce.

Will you please let me know that are you able to run any code segment of Aspose.Cells dll.
e.g

Workbook workbook = new Workbook();
workbook.Save(“c:\test.xlsx”);

Please provide me sample of code that you are able to run without exception. Please also list down all the System/Runtime environment.

The exceptions are only thrown upon opening and saving .xls files, not while doing anything else.

I’m still not sure that you’re even understanding the issue correctly. I can run all of the code successfully. That’s not the problem. The problem is that while debugging, the debugger breaks on new Workbook(“example.xls”) and on workbook.Save(“example.xls”). The debugger is breaking because exceptions are being thrown and caught inside of Aspose.Cells.

Again, the code functions successfully. It just makes the debugging process a nightmare and its clearly a bug that its throwing and catching exceptions every single time.

Are you using Visual Studio with the exception options set to break turned on to try and test this?

Hi,

Thanks for clarifying it.

It means, your problem is totally relating to debugging and not related to any Ms-Excel formats. I will let the development team know it.

If it is possible for you, can you make some video explaining the whole process/problem?