SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Cannot access a disposed object: ZipFile

Last post 04-05-2014 2:12 PM by dysert. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 04-05-2014 2:12 PM

    • dysert
    • Not Ranked
    • Joined on 04-05-2014
    • Posts 1

    Cannot access a disposed object: ZipFile

    I'm getting this error intermittently when trying to do a normal, vanilla zip of a bunch of files (about 65 files - 45MB). This is Windows 7 and the current release of ICSharpCode.SharpZipLib. I'm sorry I don't have a stack dump - the process runs "detached" from the system tray (no user interface), so when it crashes the only thing I do is write the exception's message to the Windows event log. But I can at least provide you with the relevant piece of code:

     

     

                string[ files = Directory.GetFiles(infolder);

                using (ZipFile zip = ZipFile.Create(tempfile))

                {

                    zip.BeginUpdate();

                    foreach (string file in files)

                    {

                        string name = Path.GetFileName(file);

                        if (name == "EXPORT.TXT" || name == "persist.xml")

                        {

                            zip.Add(file, name);

                            continue;

                        }

                        if (Path.GetExtension(name) != ".TIF")

                            continue;

                        try

                        {

                            // be sure it's a .tif that we want

                            val.Validate(Path.GetFileNameWithoutExtension(name));

                        }

                        catch (ArgumentException)

                        {

                            continue;

                        }

                        zip.Add(file, name);

                    }

                    zip.CommitUpdate();

                    zip.Close();

                }

    I believe the exception is occurring on the CommitUpdate call (I have an outer try/catch as a last-chance exception handler which is where I write to the event log). Can you please tell me what I'm doing wrong, or at least suggest a way where I might be able to consistently reproduce the problem? Thanks!
    Filed under: , , ,
Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.