I've been using the library for a few months on Windows 2008, but now that I've moved it to Windows 2012 R2 it's throwing an exception every time I run it.
My program updates a ZIP which contains a single file, by overwriting the ZIP file:
using (ZipFile zip = new ZipFile())
zip.ParallelDeflateThreshold = -1;
However this now throws the following exception:
Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Ionic.Zip.ZipFile.InternalAddEntry(String name, ZipEntry entry)
at Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze)
at Ionic.Zip.ZipFile.AddFile(String fileName, String directoryPathInArchive)
I thought that calling Save('filename') would simply overwrite the existing file, but as I'm getting an exception, I presume it's somehow trying to merge the temporary zip file with the file I've told it to save over.
Am I misunderstanding how it works? All I want to do is totally replace the destination zip with the new one. I realise I could delete the file first, but it's non-ideal to have this missing for any period of time (even a few seconds) and if you Delete the
file programatically, it still seems to be there after a few seconds.
Any help appreciated!