Skip to content

Commit 2576390

Browse files
committed
address code review feedback
1 parent 9fa8190 commit 2576390

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,31 @@ public Task AlreadyCanceledAsync()
7373
[Fact]
7474
[OuterLoop]
7575
[ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)]
76-
public Task ReadFileOver2GBAsync()
76+
public async Task ReadFileOver2GBAsync()
7777
{
7878
string path = GetTestFilePath();
7979
using (FileStream fs = File.Create(path))
8080
{
8181
fs.SetLength(int.MaxValue + 1L);
8282
}
8383

84-
// File is too large for ReadAllBytes at once
85-
return Assert.ThrowsAsync<IOException>(async () => await File.ReadAllBytesAsync(path));
84+
// File is too large for ReadAllBytesAsync at once
85+
await Assert.ThrowsAsync<IOException>(async () => await File.ReadAllBytesAsync(path));
8686
}
8787

8888
[Fact]
8989
[OuterLoop]
9090
[ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)]
91-
public Task MaxArrayLengthAsync()
91+
public async Task ReadFileOverMaxArrayLengthAsync()
9292
{
9393
string path = GetTestFilePath();
9494
using (FileStream fs = File.Create(path))
9595
{
9696
fs.SetLength(Array.MaxLength + 1L);
9797
}
9898

99-
// File is too large for ReadAllBytes at once
100-
return Assert.ThrowsAsync<IOException>(async () => await File.ReadAllBytesAsync(path));
99+
// File is too large for ReadAllBytesAsync at once
100+
await Assert.ThrowsAsync<IOException>(async () => await File.ReadAllBytesAsync(path));
101101
}
102102

103103
[Fact]

src/libraries/System.Private.CoreLib/src/System/IO/File.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ private static async Task<string> InternalReadAllTextAsync(string path, Encoding
526526
}
527527

528528
// SequentialScan is a perf hint that requires extra sys-call on non-Windows OSes.
529-
FileOptions options = (OperatingSystem.IsWindows() ? FileOptions.SequentialScan : FileOptions.None) | FileOptions.Asynchronous;
529+
FileOptions options = FileOptions.Asynchronous | (OperatingSystem.IsWindows() ? FileOptions.SequentialScan : FileOptions.None);
530530
SafeFileHandle sfh = OpenHandle(path, FileMode.Open, FileAccess.Read, FileShare.Read, options);
531531

532532
long fileLength = 0L;

0 commit comments

Comments
 (0)