Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I have an ASP.NET page that creates an excel file using GemBox from a data table
ExcelFile ef = new ExcelFile();
ExcelWorksheet ws = ef.Worksheets.Add("DataSheet");
ws.InsertDataTable(log, "A1", true);
Response.ContentType = "application/vnd.openxmlformats";
Response.AddHeader("Content-Disposition", "attachment; filename=oncue24"+Request["action"].ToString().Trim()+".xlsx");
MemoryStream ms = new MemoryStream();
ms.WriteTo(Response.OutputStream); // Object disposed error occurs here
ms = null;
It works under Microsoft ASP.NET, but under MONO the MemoryStream seems to have been disposed after the SaveXlsx. I have seen reference to an issue in
System.IO.Packaging in MONO (http://mono.1490590.n4.nabble.com/creating-excel-files-td3315324.html#a3319632). I have confirmed with gemBox tech support that they are using the IO.Packaging system and are closing the package.
How is it sensible that we want to create a stream using packaging and then have that stream unusable?
In the referenced link there is a quoted section from a developer:
> On Mon, Feb 28, 2011 at 3:26 PM, Rafael Teixeira<[hidden email]> wrote:
>> That is the documented (expected) behavior of Close:
>> "Saves and closes the package plus all underlying part streams."
I would suggest the developer is failing to recognize the meaning of the word underlying. Any Object passed into the Packaging class is an overlying stream, as its creating is not under the control of the Packaging class, and thus should remain open.
This was fixed in recent versions of Mono.
Please upgrade your Mono.
It took me a while to track down the fix, if you need to reopen, please provide a test case showing the broken behavior.
Thank you. I did't realize till now the Ubuntu hasn't incorporated the latest version in the repositories (still experimental). Guess I'll have to work around it for now.