Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Error adding files to a zip

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19381 |

    Hi, I’m trying to add some files to a zip using the following code, which works on most of my test machines except a Win2000 advanced server machine. I’m assuming that the stream is getting disposed of after the using… but when I don’t use the using, the stream isn’t written out. I’ve also tried Stream.Close() rather than the using.

    Can anyone help?

    Thanks

    Rich

    private void AddtoZip(string filename, string StringData)
    {
    ZippedFile file = ( ZippedFile )m_XEL.GetFile(filename);
    if( !file.Exists )

    file.Create();
    byte[] byteData = System.Text.Encoding.Default.GetBytes( StringData );
    // Write the information to the ZippedFile object
    try
    {
    using( Stream stream = file.OpenWrite( true ) )
    {
    stream.Write( byteData, 0, byteData.Length );
    }

    }
    catch (Exception ex)
    {

    System.Windows.Forms.MessageBox.Show(“Error creating zip file \n” + ex.Message

    + “\n” + ex.StackTrace);

    }

    }

    —————————

    Exception message…/stack

    —————————

    Error creating zip file

    Cannot access a disposed object.

    Object name: “ZipHandler”.

    at Xceed.Zip.ZipHandler.Flush(FileSystemEventsSession session)

    at Xceed.Zip.ZipHandler.Release(FileSystemEventsSession session)

    at Xceed.Zip.ZipHandler.ReleaseModify(FileSystemEventsSession session)

    at Xceed.Zip.ZipItemHandler.OnClosingWritingStreamEvent(Object sender, NotifyStreamArgs args)

    at Xceed.Utils.Streams.NotifyStream.OnClosingStream()

    at Xceed.Utils.Streams.NotifyStream.Dispose(Boolean disposing)

    at Xceed.Utils.Streams.NotifyStream.Close()

    at System.IO.Stream.System.IDisposable.Dispose()

    at MyNamespace.MyClass.AddtoZip(String filename, String StringData)

    Imported from legacy forums. Posted by Richard (had 3222 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Rich!

    I believe this is a known issue with an older version. Can you make sure you are using the <A HREF=”http://download2.xceedsoft.com/updates/Xceed_Zip_for_.NET_2.0.116.0.exe”>latest 2.0.116.0 version</A>?

    Imported from legacy forums. Posted by Martin (had 116 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi thanks for the quick reply,

    Yup I’m using 2.0.116.0 of Xceed.Compression.dll, Xceed.FileSystem.dll, Xceed.Zip.dll

    Thanks

    Rich

    Imported from legacy forums. Posted by Richard (had 189 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m also using .NET 1.1 don’t know if this makes a difference. Zip files contain 4 files last stream is about 150k in size uncompressed

    Thanks

    Rich

    Imported from legacy forums. Posted by Richard (had 4043 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.