I actually wrote this in Vb.Net 2008 and posted a question over at VbForums in the Vb.Net area but no joy in finding a hint at an answer so I thought I would try it here since there should not be much difference in the troublesome code between VB.Net and C#
Assume that filename and folder are defined and populated with a valid path/filename before it gets to this point.Code:Using ZP1 As ZipFile = New ZipFile(FileName) ZP1.ZipErrorAction = ZipErrorAction.Throw ' have tried it without this line no difference ZP1.AddDirectory(Folder) ZP1.Save() ' hangs here ZP1.Dispose() End Using
The problem is that the code above seems to work fine on most folders but there are a couple of folders where it just hangs on the save line.
This is part of a little archive program I wrote for personal use to make archive copies of projects which have been changed since the last backup.
Anyway there are a bunch of folders on the system and those fodlers all contain sub folders. If I have it process them all it will go throw the first 27 projects without an issue then hang on the 28th project. If I turn off the Archive Bit on that project then it makes it through 97 projects and hangs on the 98th one.
I made another routine to test which does only one project which works fine on all except those 2 projects. It hangs on both of them but on one it has worked a couple of times and then I try again and it hangs with nothing apparently different than the time it worked.
I tried using the AddFiles method and doing each folder within the project to its own zip file. When I do this it works fine on all but these 2 projects. It seems to work on all sub folders of the troublesome project but when it tries to zip the main project folder it hangs every time.
I have looked at the files in the folder and there was a .rar file and a couple of uninstall related files there. I removed these hoping that maybe that was the issue but still have the same issue. All of the files have the normal attribute at this point and the total is 142 files 6.2 mb largest file being 1.2 mb, source files, exe files MDB and a couple of icons. Nothing that I would think should be an issue.
If I try to zip the folder with WinRar it works just fine but when I try to do the parent folder using the iconic.zip class it creates a .tmp file in the target directory that seems to be about the right size and then that is as far as it goes. If I pause the application it is setting there on the save line waiting for it to finish.
Any idea what I should check to overcome this issue?