Adding files to existing 7z archive results in "...some data after the end of payload data"

When opening a 7z archive and calling CreateEntry via a .NET Stream, the result is that the archive size grows, but the added files are not listed and there is a message under the archive properties that says “There are some data after the end of the payload data”.

The code is taken from your example methods and simply run twice with new files in Append mode.

The 7z command line does not have this problem, but it is imperative that I am able to add to an archive from memory and not disk.

My POC code looks like…
try
{

            using (FileStream sevenZipFile = File.Open(archivePath,FileMode.Append))
            {
                using (FileStream source1 = new FileStream(inputFile,FileMode.OpenOrCreate))
                {
                    using (var archive = new SevenZipArchive())
                    {
                        archive.CreateEntry(inputEntryName, source1, new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings(pwd)));
                        archive.Save(sevenZipFile);
                    }
                }
            }
            Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings");
        }

This is the result after running 2 times and changing the input files and names…

image.png (33.7 KB)

@summero2,

We have logged your requirement/problem in our issue tracking system. Your ticket number is ZIPNET-708. We will further look into the details of this issue and will keep you updated here on the status of the linked ticket. We apologize for any inconvenience.