Using ms As New MemoryStream
Dim st As New GZipStream(ms, CompressionMode.Compress, True)
'... some code
Return buffer
End Using
And this:
dim As New MemoryStream
using st As New GZipStream(ms, CompressionMode.Compress, True)
'... some code
Return buffer
End Using
I had some legacy code which called Dispose() and Close() manually on the stream objects - this was causing CA2202 code analysis warnings about possible multiple calls to Dispose(). So I added using statements for both memory stream and gzipstream and the error didn't go away!?
If I used it on either the memorystream or gzipstream objects then the error then went away. Was is causing this behaviour?