ZipFile.Save() never returns..

Dec 20, 2012 at 12:39 PM

Hi all, 

I am writting a small backup utility, where i want the ability to zip directories containng the backup. Sometimes, but not alway the zipping never returns. And I am wondering why. I am developing on vs 2005 with .NET 2.0 SP1.

It is always the same file that causes the problem, it is name CameraServer.exe_ and has the size of 5148 kb. I have other files that can have filetypes that end on underscore charecter. and they zip nicely.

Does anyone have any clues? 

string zipfilename = folder.FullName + @".zip";       
using ( ZipFile zip = new ZipFile(zipfilename) ) {             
//... 
      zip.AddDirectory(folder.FullName);                    
      zip.Save();                    
//... 
}

Call stak from the background worker thread that does the zipping, and have previously copied the files.

[In a sleep, wait, or join]
System.Threading.WaitHandle.WaitOne  
System.Threading.WaitHandle.WaitOne  
System.Threading.WaitHandle.WaitOne   Ionic.Zlib.ParallelDeflateOutputStream.EmitPendingBuffers   Ionic.Zlib.ParallelDeflateOutputStream.Write  
Ionic.Crc.CrcCalculatorStream.Write  
Ionic.Zip.ZipEntry._WriteEntryData  
Ionic.Zip.ZipEntry.Write  
Ionic.Zip.ZipFile.Save
Capres.Backup.BackupController.ZipBackup C# 
Capres.Backup.BackupController.Backup C#

Jan 9, 2013 at 10:08 AM

Hello,

 

Looking at the stack trace, the only thing I can think of that can couse your problem would be that it enters a deadlock.

Try putting

zip.ParallelDeflateThreshold = -1

...

zip.Save().

 

Best regards,

Silviu.