I've been trying to use the latest version of the Open XML SDK with Mono
4.3.3 (built off the master branch), and as described at
https://github.com/OfficeDev/Open-XML-SDK/issues/74 I'm running into a
problem that looks to be a Mono issue.

I think it essentially reduces down to the situation that the code


using (ZipArchive archive = new ZipArchive(input, ZipArchiveMode.Update))
     {
         ZipArchiveEntry selectorEntry = archive.GetEntry("readme.txt");
         using (Stream temp = selectorEntry.Open())
          {
              Console.WriteLine("Open1");
          }

         using (Stream temp = selectorEntry.Open())
          {
               Console.WriteLine("Open2");
          }
     }

Works on MS .NET4.5 but on Mono throws an exception on the second open,
because it thinks the stream is already open although it has actually been
closed.

I'm wondering, should the

 if (openStream != null && Archive.Mode == ZipArchiveMode.Update)
                throw new IOException("The entry is already currently open
for writing.");

In ZipArchiveEntry.Open() be a bit more clever, and do something like check
if the stream has been disposed, even though it's non-null?



--
View this message in context: 
http://mono.1490590.n4.nabble.com/ZipArchiveEntry-issue-with-reopening-entries-tp4667333.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to