Exception : Not a valid Win32 FileTime.

Oct 14, 2011 at 8:13 PM
Edited Oct 15, 2011 at 2:01 AM

I recently downloaded this library and in the process of evaluating for my project.
I have trying to unzip a zip file using the following code


// Remove the directory part of the filename just prior to unzipping
// extracting only .xyz files
zip.ToList().Where(s => !s.IsDirectory && Path.GetExtension(s.FileName) == ".xyz").ToList().
                        ForEach(entry =>
                                entry.FileName = Path.GetFileName(entry.FileName);
                                entry.CreationTime = dtUploadTime;
                                entry.Comment = sUser;
                                entry.Extract(sUnpackDirectory, ExtractExistingFileAction.OverwriteSilently);


When the zip file is created via 7-zip the aforementioned code works fine and the unzip is successful. 

However when the file is created via Winzip I get the following error "Not a valid Win32 FileTime. " Please advise.

Stacktrace results are shown below

   at System.DateTime.ToFileTimeUtc()   at System.IO.File.SetLastAccessTimeUtc(String path, DateTime lastAccessTimeUtc)   at Ionic.Zip.ZipEntry._SetTimes(String fileOrDirectory, Boolean isFile)   at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)   at Ionic.Zip.ZipEntry.Extract(String baseDirectory, ExtractExistingFileAction extractExistingFile)   

Your timely help is appreciated.


Oct 22, 2011 at 3:48 PM

hmmm, why are you setting the creation time before extracting?

To avoid the problem, How about if you... don't do that?

I don't know what "dtUploadTime" is, but it seems that DotNetZip is choking on some transformation of it.

If you can provide a test case that reliably reproduces the problem, I'll open a workitem and get it fixed!


Oct 24, 2011 at 4:31 PM

I was able to address it using "SetEntryTimes"method.

dtUploadTime = DateTime.Now;

The scenario that required this change is

- User uploads a zip file

- System unzips the file with the Creation date

- the user will be able to search for the files based on upload date. (aka creation date in this scenario)