-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Nullable annotation for System.IO.Pipelines #41407
Conversation
@stephentoub @safern build failed for full framework, seems don't have nullable attributes added |
You need to include this file in the src csproj: https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/Diagnostics/CodeAnalysis/NullableAttributes.cs Add it under this corefx/src/System.IO.Pipelines/src/System.IO.Pipelines.csproj Lines 42 to 46 in d217998
You also need to add a corefx/src/System.IO.Pipelines/src/System.IO.Pipelines.csproj Lines 2 to 4 in d217998
<PropertyGroup>
<DefineConstants>$(DefineConstants);INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>
<Configurations>netcoreapp-Debug;netcoreapp-Release;netcoreapp3.0-Debug;netcoreapp3.0-Release;netstandard-Debug;netstandard-Release</Configurations>
</PropertyGroup> We need to include those attributes when the corefx/src/System.IO.Pipelines/src/Configurations.props Lines 2 to 11 in d217998
So whenever we build for uap/netfx it will use the |
@safern added the reference, thank you! |
src/System.IO.Pipelines/src/System/IO/Pipelines/BufferSegment.cs
Outdated
Show resolved
Hide resolved
@@ -106,7 +107,7 @@ public void SetNext(BufferSegment segment) | |||
|
|||
while (segment.Next != null) | |||
{ | |||
segment.NextSegment.RunningIndex = segment.RunningIndex + segment.Length; | |||
segment.NextSegment!.RunningIndex = segment.RunningIndex + segment.Length; |
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.
@davidfowl, is it correct that this is accessing NextSegment but the while above is using Next? It's not clear to me what the difference is.
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.
Seems at least better assert it instead bang.
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 actually confused me as well 😄 . I think they are the same. I'm not sure why we're using Next for the null check.
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.
@davidfowl do you want to change segment.Next
null check with segment.NextSegment
with this PR or its fine as is?
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.
I am going to leave it as is and merge this PR, we can revisit later if needed
src/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
src/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
src/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
src/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeWriter.cs
Outdated
Show resolved
Hide resolved
@stephentoub @safern please re review |
* Nullable annotation for System.IO.Pipelines Commit migrated from dotnet/corefx@48363ac
Contributes to #40623
cc: @dotnet/nullablefc