ZipErrorAction.InvokeErrorEvent doesn't invoke when a 'Path to long exception' is thrown

Dec 6, 2011 at 7:16 AM

I made an application to zip folders for backup purposes, but when i hit a folder thats "too long" it doesn't invoke the event.

        private void CreateCompressedFileFromFolder(string compressedPathFileName, string innerFolderName, string folderPath,
            IEnumerable<string> fileNamesToRemoveFromCompressedFile = null, IEnumerable<string> folderNamesToRemoveFromCompressedFile = null)
            using (var zip = new ZipFile())
                zip.UseZip64WhenSaving = Zip64Option.AsNecessary;
                zip.SortEntriesBeforeSaving = true;
                zip.ZipError += CreateCompressedFileFromFolder_ZipError;
                zip.ZipErrorAction = ZipErrorAction.InvokeErrorEvent;
                zip.AddDirectory(folderPath, innerFolderName);

        private void CreateCompressedFileFromFolder_ZipError(object sender, ZipErrorEventArgs e)
            Log.Error("Error adding the followinf file to the archive: " + e.FileName, e.Exception);
            e.CurrentEntry.ZipErrorAction = ZipErrorAction.Skip;

Can anyone see why?