1
Vote

Unzipping docx throws ObjectDisposedException

description

I am trying to read document.xml file from docx zip. The code I use to accomplish this is super-easy and is attached as screenshot along with exception detail.
In short: open a ZipFile (using StreamResourceInfo class in WP7) , get a ZipEntry by filename, if ZipEntry is not null - call zipFile.GetInputStream(zipEntry) to get stream, init byte buffer in zipEntry.Size, read stream into buffer <<-- ObjectDisposedException.
 
Can anyone tell me whether this is bug or I am doing something wrong? Can anyone test it? Thanks!

file attachments

comments

jumbo wrote Mar 3, 2011 at 9:51 PM

I just try exactly same process with exactly same code, but with epub (which is zipped too) and it works ok. So I suppose it has something to do with docx format. But I have no idea what can be different/wrong.

jumbo wrote Mar 3, 2011 at 10:05 PM

I just figured it out. It was my fault! I apologize for this.
The mistake was that I created ZipFile instance twice (two methods, each created its own ZipFile). The second one was not working. When I use only one instance for both methods, it works.

Once again - sorry for confusion,

wrote Feb 14, 2013 at 7:55 PM