When creating a password-protected ZIP archive, if I create a new entry and write to it, and during this process create, write and close a second entry, then the first entry appears to be corrupt when you try to read the file.
For example, the following see the following program:
static void Main(string[] args){ // Create the main ZIP file using (var zipStream = File.Create(@"c:\temp\test.zip")) { var encrypt = new DefaultEncryptionSettings { Password = "nick" }; using (var zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create,true,null,null,encrypt)) { // Create the 1st entry. using (var entry1 = zipArchive.CreateEntry("text1.txt")) { using (var stream1 = entry1.Open()) { using (var writer1 = new StreamWriter(stream1)) { writer1.WriteLine("Writer 1 line 1"); // While writing the 1st entry, create a second entry using (var entry2 = zipArchive.CreateEntry("text2.txt")) { using (var stream2 = entry2.Open()) { using (var writer2 = new StreamWriter(stream2)) { writer2.WriteLine("Writer 2 line 1"); } } } // Continue writing the 1st entry. writer1.WriteLine("Writer 1 line 2"); } } } } }}
This runs without error. Opening the file using 7-zip, I can read the "text2.txt" entry with no problem with the correct password. However, opening the "text1.txt" file gives an error suggesting the password is wrong.
Program in .NET 4.6, using Telerik.Windows.Zip 2018.3.1010.40.
