Repository: dotnet/runtime
File: src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/OpenNullHandle.cs (C#)

Code before:
        public void OpenNullHandle_SyncReadSpan_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read);
            
            byte[] buffer = new byte[100];
            int bytesRead = stream.Read(buffer.AsSpan());
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public async Task OpenNullHandle_AsyncRead_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read, 4096, true);
            
            byte[] buffer = new byte[100];
            int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public async Task OpenNullHandle_AsyncReadMemory_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read, 4096, true);
            
            byte[] buffer = new byte[100];
            int bytesRead = await stream.ReadAsync(buffer.AsMemory());
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public void OpenNullHandle_SyncWrite_Succeeds()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Write);
            
            byte[] buffer = new byte[100];
            // Should not throw
            stream.Write(buffer, 0, buffer.Length);
        }

        [Fact]
        public void OpenNullHandle_SyncWriteSpan_Succeeds()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Write);
            
            byte[] buffer = new byte[100];
            // Should not throw

Review comment (suggestion):
```suggestion
            using FileStream stream = new FileStream(handle, FileAccess.Read);
```

Code after:
        [Fact]
        public void OpenNullHandle_SyncReadSpan_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read);
            
            byte[] buffer = new byte[100];
            int bytesRead = stream.Read(buffer.AsSpan());
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public async Task OpenNullHandle_AsyncRead_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read);
            
            byte[] buffer = new byte[100];
            int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public async Task OpenNullHandle_AsyncReadMemory_ReturnsZero()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Read);
            
            byte[] buffer = new byte[100];
            int bytesRead = await stream.ReadAsync(buffer.AsMemory());
            Assert.Equal(0, bytesRead);
        }

        [Fact]
        public void OpenNullHandle_SyncWrite_Succeeds()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Write);
            
            byte[] buffer = new byte[100];
            // Should not throw
            stream.Write(buffer, 0, buffer.Length);
        }

        [Fact]
        public void OpenNullHandle_SyncWriteSpan_Succeeds()
        {
            using SafeFileHandle handle = File.OpenNullHandle();
            using FileStream stream = new FileStream(handle, FileAccess.Write);
            
            byte[] buffer = new byte[100];