2
Vote

Parallel Foreach giving issue in compression

description

Hi,

I have used parallel foreach in my project which compresses number of text files present in a particular folder.
I have executed the project n number of times and some folders are giving issues while compression and exception thrown states as follows:

"The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive"

I am not able to detect what the actual error is.
When the same folders I try to compress individually, it gets compressed.

Code snippet is as follows:
    public static bool ZipFileUsingDLL(string strZipFileName, string strInputFolder)
    {
        bool result = true;
        try
        {

           SevenZipCompressor.SetLibraryPath(@"Path of 7z.dll");

            var tmp = new SevenZipCompressor();


            tmp.CompressionMethod = CompressionMethod.Lzma;
            tmp.CompressionLevel = CompressionLevel.Ultra;
            tmp.VolumeSize = 9000000;
            tmp.CompressDirectory(strInputFolder, strZipFileName);

        }
        catch (Exception ex)
        {

        }

            return result;

    }

file attachments

comments

trebor678 wrote Jan 31 at 2:54 PM

I've got the same kind of issue when running multiple threads in a parallel foreach. I've managed to catch the exception (attached screenshot; sorry for the bad quality)