"End of stream reached with 3171 bytes left to read" when saving Excel file

Hello,
Invoking the "Save" function of an "XlsFile" object generates the exception :
End of stream reached with 3171 bytes left to read
This is valid for version 7.12.1, while version 7.7.0 works

Hi,
This is normally a problem in how you read or write the file. Are you saving it or loading it to/from a memorystream? If so, make sure you are using MemoryString.ToArray and not .GetBuffer, since getbuffer returns grabage at the end and can cause problems like this one.

I don't think anything that could affect this has changed from 7.7 to 7.12, and I haven't had any other similar report. Maybe this could have been caused because you also upgraded the .NET framework when you upgraded FlexCel?

If you can send me a reproducible project to adrian@tmssoftware.com (or post it here), we will for sure know what happens, but if you can't, some things that could help me are:

  1. Is this a web app or winforms or something else?
  2. What version of .NET?
  3. Can you post the block of code which call Save() to see if I can detect something wrong?

Hello Adrian,
Thank you for your quick reply.

It is a Xamarin Forms solution.

The problem occurs during saving the Excel file.
It is working without any issue on UWP, but fails on Android and iOS projects

Please find hereby a solution that reproduces the problem
App1.zip (692.9 KB)

Thanks for the file, I got it and we could find the problem.
The bug happened in platforms using mono (basically ios/android), because of a workaround for a bug in those platforms.

It was fixed and 7.13 (hopefully to be released this week) will have the fix.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.