diff --git a/src/TestableIO.System.IO.Abstractions/FileSystemStream.cs b/src/TestableIO.System.IO.Abstractions/FileSystemStream.cs index 8709ecbce..c8553e740 100644 --- a/src/TestableIO.System.IO.Abstractions/FileSystemStream.cs +++ b/src/TestableIO.System.IO.Abstractions/FileSystemStream.cs @@ -223,15 +223,6 @@ protected override void Dispose(bool disposing) base.Dispose(disposing); } -#if FEATURE_ASYNC_FILE - /// - public override async ValueTask DisposeAsync() - { - await _stream.DisposeAsync(); - await base.DisposeAsync(); - } -#endif - /// /// Allows to cast the internal Stream to a FileStream /// diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileStreamTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileStreamTests.cs index a55257c27..06eedd52c 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileStreamTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileStreamTests.cs @@ -283,6 +283,18 @@ public void MockFileStream_Null_ShouldReturnSingletonObject() Assert.That(result1, Is.SameAs(result2)); } + + #if FEATURE_ASYNC_FILE + [Test] + public async Task MockFileStream_DisposeAsync_ShouldNotThrow() + { + var fileSystem = new MockFileSystem(); + fileSystem.File.WriteAllText("foo.txt", ""); + { + await using var reportStream = fileSystem.File.OpenRead("foo.txt"); + } + } + #endif [Test] public void MockFileStream_Null_ShouldHaveExpectedProperties()