Skip to content

Disable CA2022 errors #39992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/RazorSdk/Tool/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ public override async Task WaitForDisconnectAsync(CancellationToken cancellation
try
{
ServerLogger.Log($"Before poking pipe {Identifier}.");
#pragma warning disable CA2022 // Avoid inexact read
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why this warning is not documented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely new, and hyperlink doesn't resolve to a valid page. This warning started showing last week when we picked up .NET 9.0 Preview 4 SDK, in our VMR builds.

await Stream.ReadAsync(Array.Empty<byte>(), 0, 0, cancellationToken);
#pragma warning restore CA2022
ServerLogger.Log($"After poking pipe {Identifier}.");
}
catch (OperationCanceledException)
Expand Down
2 changes: 2 additions & 0 deletions src/RazorSdk/Tool/ConnectionHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public override async Task WaitForDisconnectAsync(CancellationToken cancellation
try
{
ServerLogger.Log($"Before poking pipe {Identifier}.");
#pragma warning disable CA2022 // Avoid inexact read
await Stream.ReadAsync(Array.Empty<byte>(), 0, 0, cancellationToken);
#pragma warning restore CA2022
ServerLogger.Log($"After poking pipe {Identifier}.");
}
catch (OperationCanceledException)
Expand Down