-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove unnecessary CA2022 suppressions #47904
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request removes the unnecessary CA2022 warning suppressions from test files to clean up the code. The changes update the test files by removing obsolete #pragma warning disable/restore statements.
- Removed CA2022 suppression in GivenDotnetSlnAdd.cs
- Removed CA2022 suppression in GivenDotnetSlnRemove.cs
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
test/dotnet-sln.Tests/GivenDotnetSlnAdd.cs | Removed obsolete CA2022 suppression lines |
test/dotnet-sln.Tests/GivenDotnetSlnRemove.cs | Removed obsolete CA2022 suppression lines |
Those are instances of FileStream, rather than MemoryStream or UnmanagedMemoryStream, so the CA2022 warnings correspond to actual bugs in the tests. Do you intend to fix those, e.g. by making the tests call Stream.ReadExactly? |
Yes, I'm trying to fix the CA 2022 warnings by calling Stream.ReadExactly. |
Add @dotnet/source-build and @dotnet/product-construction as reviewers. |
src/RazorSdk/Tool/Client.cs
Outdated
#if NET | ||
await Stream.ReadExactlyAsync(Array.Empty<byte>(), 0, 0, cancellationToken); | ||
#else | ||
await Stream.ReadAsync(Array.Empty<byte>(), 0, 0, cancellationToken); | ||
#pragma warning restore CA2022 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using #if NET
to choose between ReadExactlyAsync and ReadAsync, I think it would be better to conditionally define ReadExactlyAsync as an extension method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: 57ed326
Related to dotnet/source-build#4322
Remove all the unnecessary CA2022 suppressions
VMR: https://dev.azure.com/dnceng/internal/_build/results?buildId=2673846&view=results (internal Microsoft link)