1
Vote

System.ObjectDisposedException: Cannot access a closed file

description

I have this code:
Using zip As ZipFile = New ZipFile()
                    zip.UseZip64WhenSaving = Zip64Option.AsNecessary
                    If (tamMaxFichero IsNot Nothing) Then
                        zip.MaxOutputSegmentSize = tamMaxFichero
                    End If

                    zip.UpdateDirectory(rutaDirectorio)
                    If (exclusiones IsNot Nothing) Then
                        Dim entradas As List(Of Ionic.Zip.ZipEntry)
                        For Each exclusion In exclusiones
                            entradas = zip.Entries.Where(Function(f) f.FileName.ToUpper().Contains(exclusion.ToUpper())).ToList()
                            For Each entrada In entradas
                                zip.RemoveEntry(entrada)
                            Next
                        Next
                    End If

                    zip.CompressionLevel = nivelCompresion
                    zip.Save(ficheroSalida)
                End Using
Sometimes (not always) I get a System.ObjectDisposedException exception. Anyone can help me or tell me what is happening. Any solution to this?

Thanks in advance

comments

kiquenet wrote Aug 21, 2013 at 1:10 PM

any solution about it ?