Cleanup NonDisposingStream for reuse

- Remove the duplicate `GC.SuppressFinalization` call
(called in `System.IO.Stream)
- Improve the `ThrowOnDispose` error message
This commit is contained in:
Matt Kotsenas
2018-07-11 12:19:34 -07:00
parent c2bf540057
commit 6c2e5e1164

View File

@@ -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}");
}
}