This project is read-only.


FileNotFoundException when creating a Self Extracting Zip file


When creating self extracting zips with multiple threads this error occurs:
Message: Could not find file 'E:\TEMP\Ionic.Zip-2011May06-141232-1.exe'.
Source: mscorlib
ErrorType: System.IO.FileNotFoundException
It looks like the there are no locks around the critical section where the file name is being generated or its existence is begin checked. Another solution would be to use a GUID as the file name.
internal static string GenerateTempPathname(string extension)
        string candidate = null;
        String AppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
        string parentDir = System.IO.Path.GetTempPath();
        int index = 0;
            string Name = String.Format("{0}-{1}-{2}.{3}",
                    AppName, System.DateTime.Now.ToString("yyyyMMMdd-HHmmss"), index, extension);
            candidate = System.IO.Path.Combine(parentDir, Name);
        } while (System.IO.File.Exists(candidate) || System.IO.Directory.Exists(candidate));
        // this file/path does not exist.  It can now be created, as file or directory.
        return candidate;
Closed Jun 22, 2011 at 12:37 AM by Cheeso
fixed in changeset 79579. The first binary with this fix will be v1.9.1.6