Address System.Runtime and System.Runtime.Extensions nullable feedback (dotnet/corefx...
authorSantiago Fernandez Madero <safern@microsoft.com>
Tue, 11 Jun 2019 21:52:22 +0000 (16:52 -0500)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2019 21:52:22 +0000 (16:52 -0500)
* Address System.Runtime and System.Runtime.Extensions nullable feedback

* PR Feedback

Commit migrated from https://github.com/dotnet/corefx/commit/e3dd986b1ba2ec80bba84aee5a4b4527db087ce2

src/libraries/System.Runtime.Extensions/src/System/IO/BufferedStream.cs
src/libraries/System.Runtime/src/System/Runtime/NgenServicingAttributes.cs

index 35a8fe9..a92a81a 100644 (file)
@@ -145,11 +145,12 @@ namespace System.IO
                 _buffer = new byte[_bufferSize];
         }
 
-        public Stream? UnderlyingStream
+        public Stream UnderlyingStream
         {
             get
             {
-                return _stream;
+                // _stream can be null when disposed. However we don't want to make UnderlyingStream nullable just for that scenario, since doing operations after dispose is invalid anyway.
+                return _stream!;
             }
         }
 
index 6d53595..303f6e3 100644 (file)
@@ -7,9 +7,9 @@ namespace System.Runtime
     [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
     public sealed class AssemblyTargetedPatchBandAttribute : Attribute
     {
-        public string? TargetedPatchBand { get; }
+        public string TargetedPatchBand { get; }
 
-        public AssemblyTargetedPatchBandAttribute(string? targetedPatchBand)
+        public AssemblyTargetedPatchBandAttribute(string targetedPatchBand)
         {
             TargetedPatchBand = targetedPatchBand;
         }
@@ -18,9 +18,9 @@ namespace System.Runtime
     [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
     public sealed class TargetedPatchingOptOutAttribute : Attribute
     {
-        public string? Reason { get; }
+        public string Reason { get; }
 
-        public TargetedPatchingOptOutAttribute(string? reason)
+        public TargetedPatchingOptOutAttribute(string reason)
         {
             Reason = reason;
         }