From 6c2e5e116436fef65648b9dbd378060ccbdbf335 Mon Sep 17 00:00:00 2001 From: Matt Kotsenas Date: Wed, 11 Jul 2018 12:19:34 -0700 Subject: [PATCH] Cleanup NonDisposingStream for reuse - Remove the duplicate `GC.SuppressFinalization` call (called in `System.IO.Stream) - Improve the `ThrowOnDispose` error message --- src/SharpCompress/IO/NonDisposingStream.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SharpCompress/IO/NonDisposingStream.cs b/src/SharpCompress/IO/NonDisposingStream.cs index 2c9e72c4..d78b1bfb 100644 --- a/src/SharpCompress/IO/NonDisposingStream.cs +++ b/src/SharpCompress/IO/NonDisposingStream.cs @@ -15,10 +15,9 @@ namespace SharpCompress.IO protected override void Dispose(bool disposing) { - GC.SuppressFinalize(this); if (ThrowOnDispose) { - throw new InvalidOperationException(); + throw new InvalidOperationException($"Attempt to dispose of a {nameof(NonDisposingStream)} when {nameof(ThrowOnDispose)} is {ThrowOnDispose}"); } }