-
Notifications
You must be signed in to change notification settings - Fork 466
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
Analyzer: Prefer Memory overloads for Stream async Read/Write methods #3497
Merged
carlossanlop
merged 14 commits into
dotnet:master
from
carlossanlop:PreferStreamAsyncMemoryOverloads
Apr 29, 2020
Merged
Analyzer: Prefer Memory overloads for Stream async Read/Write methods #3497
carlossanlop
merged 14 commits into
dotnet:master
from
carlossanlop:PreferStreamAsyncMemoryOverloads
Apr 29, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
carlossanlop
requested review from
jeffhandley,
stephentoub,
pgovind,
mavasani,
bartonjs and
buyaa-n
April 14, 2020 01:31
carlossanlop
commented
Apr 14, 2020
carlossanlop
commented
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloadsFixer.cs
Outdated
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
...rs/UnitTests/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloadsTestBase.cs
Outdated
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
...s/UnitTests/Microsoft.NetCore.Analyzers/Runtime/PreferStreamReadAsyncMemoryOverloadsTests.cs
Outdated
Show resolved
Hide resolved
carlossanlop
commented
Apr 14, 2020
...rs/UnitTests/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloadsTestBase.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 14, 2020
...s/UnitTests/Microsoft.NetCore.Analyzers/Runtime/PreferStreamReadAsyncMemoryOverloadsTests.cs
Outdated
Show resolved
Hide resolved
carlossanlop
force-pushed
the
PreferStreamAsyncMemoryOverloads
branch
from
April 15, 2020 04:34
1b95644
to
7e85824
Compare
…n description as to why the overloads are preferred.
Typo in a unit test.
carlossanlop
force-pushed
the
PreferStreamAsyncMemoryOverloads
branch
from
April 27, 2020 21:29
92b2053
to
3369442
Compare
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 27, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Show resolved
Hide resolved
mavasani
reviewed
Apr 28, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
reviewed
Apr 28, 2020
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
mavasani
approved these changes
Apr 28, 2020
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.
LGTM, thanks!
@buyaa-n @stephentoub @bartonjs can I get a sign off from you please, if everything looks good? |
buyaa-n
approved these changes
Apr 28, 2020
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.
Small comment, looks good, thanks!
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
Outdated
Show resolved
Hide resolved
Co-Authored-By: buyaa-n <buyankhishig.namnan@microsoft.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contributes to dotnet/runtime#33790
Summary
If the user invokes any of these methods from an object that is or inherits from
Stream
:ReadAsync(Byte[], Int32, Int32)
ReadAsync(Byte[], Int32, Int32, CancellationToken)
WriteAsync(Byte[], Int32, Int32)
WriteAsync(Byte[], Int32, Int32, CancellationToken)
We should suggest to instead use:
ReadAsync(Memory<Byte>, CancellationToken)
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)
All unit tests passed locally.