Apr 20, 2010 at 8:58 PM

First off, I just want to tell you want a great product you have here. I am using your library in a multithreaded application where each thread creates its own instance of a ZipOutputStream. The problem I see is that execution wise everything seems to be working, but one of the output files does not seem to be created. That is I cannot see the file in explorer; but, if I trace through the with the debugger, it seems like the calls to Write, etc. are working. The files created on other threads seem to be working just fine. Even when the file is finally close, it still shows nothing. The other wierd thing is it does not seem to happen 100 percent of the time.

When I first started to try out your lib, I asked you about multithreading and you stated it should work fine if each thread had its own instance.

Thank you for any help you can give me.

 private void OpenZipFile()

{ <font size="2">


</font>string FileName = FFilePath + FDatePartOfPath + FFilePrefix + FileDate + ".zip";<font size="2"> </font> 

<font size="2">


</font>FZipStream = new FileStream (FileName, FileMode.Append, FileAccess.Write, FileShare.Read);  

FZipFolderPath = FileName;

<font size="2">

FZip =

</font>new ZipOutputStream(FZipStream, true);
<font size="2"> </font>

<font size="2">

FZip.Password =


FZip.PutNextEntry(FFilePrefix + FileDate + FFileExtension);           Extension here is .trc; it is a log file.

<font size="2">





When I write to it:

FCache.WriteTo(Stream);<font size="2">


byte[] Bytes = new byte[FCache.Position];<font size="2">


int Pos = (int)FCache.Position;

FCache.Position = 0;

FCache.Read(Bytes, 0, Pos);

FZip.Write(Bytes, 0, Pos);


<font size="2">


long<font size="2"> Temp = FZipStream.Position;</font>



string FileDate = FFileDateTime.ToString("yyyyMMdd.HHmm");



<font size="2">


</font>if (FZipStream == null)

Apr 21, 2010 at 3:24 PM

ok, I understand what you're saying.  Your code didn't show up as readable, but I understand what you're saying. 

To solve it, I would need a test case, something that starts a bunch of threads, and writes zip files within them, and reproduces the behavior.

It's possible there's some sort of problem in the Dotnetzip code.  it's also possible there's a problem in the thread creation and dispatch code.  Without a way to reliably reproduce the problem....  I can't really diagnose it or solve it.




Apr 21, 2010 at 6:04 PM

I found my problem, and it had nothing to do with your library. It was a startup problem on my part and the file was open but in another directory.

I apologize for having wasted your time on this.

Thank you.

Apr 21, 2010 at 9:21 PM

no problem. glad you sorted it.