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
Use throw helpers in a few more places #82533
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.
Don't forgot the nullable annotations :)
src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/BrotliStream.cs
Show resolved
Hide resolved
...aries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs
Show resolved
Hide resolved
I believe |
These methods are private. If the caller doesn't try to dereference the cited member, such attribution doesn't help with anything. |
@@ -295,13 +295,19 @@ private static unsafe string Ctor(ReadOnlySpan<char> value) | |||
|
|||
public static string Create<TState>(int length, TState state, SpanAction<char, TState> action) | |||
{ | |||
ArgumentNullException.ThrowIfNull(action); | |||
if (action is null) |
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.
@stephentoub: Just out of curiosity, why was this changed?
PS. I should sleep more :(
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.
This pattern results in ever so slightly smaller asm, and as it's in a generic method and we already had the helper and the appropriately named constant argument and I was already editing the method, it was trivial to switch.
No description provided.