Bug 1464 - System.IO.Packaging.ZipPackage throws an exception when calling Close() multiple times
Summary: System.IO.Packaging.ZipPackage throws an exception when calling Close() multi...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2011-10-12 17:43 UTC by mariok
Modified: 2011-10-17 19:53 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED FIXED

Comment 1 Miguel de Icaza [MSFT] 2011-10-16 12:09:25 UTC
Alan, another bug for you, could you comment and apply to mono-2-10 and master?
Comment 2 Alan McGovern 2011-10-17 16:01:07 UTC
Hi,

I wrote some unit tests to cover these changes and it turns out that if you give the package API a stream, it does not close it no matter what type of stream it is. It only closes streams which it creates itself.

I also added a test for closing the same package twice. I'll commit a modified version of your patch soon which will cope with the behaviour the new tests uncovered. Thanks for the report and the patch. It was useful to see possible fixes as well as the description :)
Comment 4 Alan McGovern 2011-10-17 18:34:37 UTC
I have two tests covering the issue, one does a double close and also a double dispose. The second test ensures that Dispose is not called on the stream if you pass it to the Package constructor. So both this scenarios are covered by tests now. The fix will be in the next release of our products though if you wish to test beforehand I should hopefully be able to provide you with a package to test with. If you do wish to test, let me know what operating system/product you have. i.e. are you using Mono on Windows or perhaps MonoTouch on MacOS.
Comment 6 Alan McGovern 2011-10-17 19:53:13 UTC
Fixed in git master and the 2-10 branch. You can test the fixes by following the instructions here for building from git: http://www.mono-project.com/Compiling_Mono_From_Git

Do let me know if you come across any other issues. Patches are definitely always welcome too!