PR Feedback
authorSantiago Fernandez Madero <safern@microsoft.com>
Tue, 4 Jun 2019 06:37:44 +0000 (23:37 -0700)
committerSantiago Fernandez Madero <safern@microsoft.com>
Tue, 4 Jun 2019 06:43:54 +0000 (23:43 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/9d98b4875ae456d3f58cae75c009afabf19d0d15

30 files changed:
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolMethod.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
src/coreclr/src/System.Private.CoreLib/src/System/ValueType.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Nullable.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeNamedArgument.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/Opcode.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/FieldInfo.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBase.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ValueTask.cs
src/libraries/System.Private.CoreLib/src/System/Type.Enum.cs

index 6b0b049..d57ee64 100644 (file)
@@ -62,7 +62,7 @@ namespace System.Reflection
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private extern byte[] ComputePublicKeyToken();
+        private extern byte[]? ComputePublicKeyToken();
 
         internal void SetProcArchIndex(PortableExecutableKinds pek, ImageFileMachine ifm)
         {
index 9cd4b90..999327c 100644 (file)
@@ -112,7 +112,7 @@ namespace System.Reflection
 
             // No pseudo attributes for RuntimeAssembly
 
-            return GetCustomAttributes((RuntimeModule)target.ManifestModule!, RuntimeAssembly.GetToken(target.GetNativeHandle()));
+            return GetCustomAttributes((RuntimeModule)target.ManifestModule, RuntimeAssembly.GetToken(target.GetNativeHandle()));
         }
 
         internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target)
index ce0438d..072b360 100644 (file)
@@ -497,7 +497,7 @@ namespace System.Reflection.Emit
             return InternalAssembly.GetType(name, throwOnError, ignoreCase);
         }
 
-        public override Module? ManifestModule => _manifestModuleBuilder.InternalModule;
+        public override Module ManifestModule => _manifestModuleBuilder.InternalModule;
 
         public override bool ReflectionOnly => InternalAssembly.ReflectionOnly;
 
index 0ee2ecd..4f6e60c 100644 (file)
@@ -190,13 +190,10 @@ namespace System.Reflection.Emit
             return m_methodBuilder.GetModule();
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        // This always returns null. Is that what we want?
-        internal override Type? GetReturnType()
+        internal override Type GetReturnType()
         {
             return m_methodBuilder.ReturnType;
         }
-#pragma warning restore CS8609
 
         public string Signature
         {
index d9a702b..10d6710 100644 (file)
@@ -738,12 +738,10 @@ namespace System.Reflection.Emit
             return m_localSignature;
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         internal override byte[]? GetRawEHInfo()
         {
             return m_exceptionHeader;
         }
-#pragma warning restore CS8609
 
         internal override unsafe void GetEHInfo(int excNumber, void* exc)
         {
@@ -770,10 +768,7 @@ namespace System.Reflection.Emit
             }
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         internal override string? GetStringLiteral(int token) { return m_scope.GetString(token); }
-#pragma warning restore CS8609
-
 
         internal override void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle)
         {
@@ -839,12 +834,10 @@ namespace System.Reflection.Emit
             }
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         internal override byte[]? ResolveSignature(int token, int fromMethod)
         {
             return m_scope.ResolveSignature(token, fromMethod);
         }
-#pragma warning restore CS8609
 
         internal override MethodInfo GetDynamicMethod()
         {
index 1b5706d..51f30ab 100644 (file)
@@ -86,16 +86,7 @@ namespace System.Reflection.Emit
             m_strName = name;
             m_module = mod;
             m_containingType = type;
-
-
-            if (returnType == null)
-            {
-                m_returnType = typeof(void);
-            }
-            else
-            {
-                m_returnType = returnType;
-            }
+            m_returnType = returnType ?? typeof(void);
 
             if ((attributes & MethodAttributes.Static) == 0)
             {
@@ -649,9 +640,7 @@ namespace System.Reflection.Emit
 
         public override bool IsGenericMethod { get { return m_inst != null; } }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        public override Type[]? GetGenericArguments() { return m_inst; }
-#pragma warning restore CS8609
+        public override Type[] GetGenericArguments() => m_inst ?? Array.Empty<Type>();
 
         public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
         {
index 458ed26..00c5412 100644 (file)
@@ -96,7 +96,7 @@ namespace System.Reflection.Emit
             }
         }
 
-        public override ParameterInfo ReturnParameter { get { throw new NotSupportedException(); } }
+        public override ParameterInfo? ReturnParameter { get { throw new NotSupportedException(); } }
         public override ICustomAttributeProvider ReturnTypeCustomAttributes { get { throw new NotSupportedException(); } }
         public override MethodInfo GetBaseDefinition() { throw new NotSupportedException(); }
         #endregion
index ed96eee..790175c 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Reflection.Emit
             TypeBuilder.SetConstantValue(
                 _methodBuilder.GetModuleBuilder(),
                 _token.Token,
-                _position == 0 ? _methodBuilder.ReturnType! : _methodBuilder.m_parameterTypes![_position - 1],
+                _position == 0 ? _methodBuilder.ReturnType : _methodBuilder.m_parameterTypes![_position - 1],
                 defaultValue);
         }
 
index 87775e6..a2573cc 100644 (file)
@@ -13,7 +13,7 @@ namespace System.Reflection.Emit
         private Type m_containingType;
         private string m_name;
         private CallingConventions m_callingConvention;
-        private Type? m_returnType;
+        private Type m_returnType;
         private MethodToken m_mdMethod;
         private Type[] m_parameterTypes;
         private SignatureHelper m_signature;
@@ -33,7 +33,7 @@ namespace System.Reflection.Emit
             m_mdMethod = token;
 
             // The ParameterTypes are also a bit interesting in that they may be unbaked TypeBuilders.
-            m_returnType = returnType;
+            m_returnType = returnType ?? typeof(void);
             if (parameterTypes != null)
             {
                 m_parameterTypes = new Type[parameterTypes.Length];
@@ -118,8 +118,7 @@ namespace System.Reflection.Emit
         #endregion
 
         #region MethodInfo Overrides
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        public override Type? ReturnType
+        public override Type ReturnType
         {
             get
             {
@@ -127,6 +126,7 @@ namespace System.Reflection.Emit
             }
         }
 
+#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override ICustomAttributeProvider? ReturnTypeCustomAttributes
         {
             get { return null; }
index 9d15357..806308f 100644 (file)
@@ -1250,9 +1250,7 @@ namespace System.Reflection.Emit
             return TypeBuilderInstantiation.MakeGenericType(this, typeArguments);
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        public override Type[]? GetGenericArguments() { return m_inst; }
-#pragma warning restore CS8609
+        public override Type[] GetGenericArguments() => m_inst ?? Array.Empty<Type>();
 
         // If a TypeBuilder is generic, it must be a generic type definition
         // All instantiated generic types are TypeBuilderInstantiation.
index 6543039..750c3e8 100644 (file)
@@ -75,7 +75,7 @@ namespace System.Reflection.Emit
 
         #region Public Abstract\Virtual Members
         public override Type ReturnType { get { return m_method.ReturnType; } }
-        public override ParameterInfo ReturnParameter { get { throw new NotSupportedException(); } }
+        public override ParameterInfo? ReturnParameter { get { throw new NotSupportedException(); } }
         public override ICustomAttributeProvider ReturnTypeCustomAttributes { get { throw new NotSupportedException(); } }
         public override MethodInfo GetBaseDefinition() { throw new NotSupportedException(); }
         #endregion    
@@ -110,12 +110,10 @@ namespace System.Reflection.Emit
             return m_ctor.GetParameterTypes();
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        internal override Type? GetReturnType()
+        internal override Type GetReturnType()
         {
-            return DeclaringType;
+            return m_type;
         }
-#pragma warning restore CS8609
 
         #region MemberInfo Overrides
         public override MemberTypes MemberType { get { return m_ctor.MemberType; } }
index 9e7dd0a..f4cee24 100644 (file)
@@ -66,14 +66,12 @@ namespace System.Reflection
         public override bool IsSecuritySafeCritical { get { return DeclaringType!.IsSecuritySafeCritical; } }
         public override bool IsSecurityTransparent { get { return DeclaringType!.IsSecurityTransparent; } }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         [DebuggerStepThroughAttribute]
         [Diagnostics.DebuggerHidden]
         public override object? GetValueDirect(TypedReference obj)
         {
             return GetValue(null);
         }
-#pragma warning restore CS8609
 
         [DebuggerStepThroughAttribute]
         [Diagnostics.DebuggerHidden]
@@ -89,9 +87,7 @@ namespace System.Reflection
             return GetValue(false);
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override object? GetRawConstantValue() { return GetValue(true); }
-#pragma warning restore CS8609
 
         private object? GetValue(bool raw)
         {
index a5dbc61..ca75d25 100644 (file)
@@ -188,7 +188,6 @@ namespace System.Reflection
 
         public override object GetRawConstantValue() { throw new InvalidOperationException(); }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         [DebuggerStepThroughAttribute]
         [Diagnostics.DebuggerHidden]
         public override object? GetValueDirect(TypedReference obj)
@@ -202,7 +201,6 @@ namespace System.Reflection
                 return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, &obj, (RuntimeType?)DeclaringType);
             }
         }
-#pragma warning restore CS8609
 
         [DebuggerStepThroughAttribute]
         [Diagnostics.DebuggerHidden]
index d5eda80..9239b12 100644 (file)
@@ -103,7 +103,7 @@ namespace System.Reflection
                     GetFlags() | AssemblyNameFlags.PublicKey,
                     null); // strong name key pair
 
-            Module? manifestModule = ManifestModule;
+            Module manifestModule = ManifestModule;
             if (manifestModule != null)
             {
                 if (manifestModule.MDStreamVersion > 0x10000)
@@ -271,7 +271,7 @@ namespace System.Reflection
             throw new PlatformNotSupportedException();
         }
 
-        public override Module? ManifestModule
+        public override Module ManifestModule
         {
             get
             {
index 4c95894..5d8be5d 100644 (file)
@@ -376,7 +376,6 @@ namespace System.Reflection
             return RuntimeMethodHandle.InvokeMethod(obj, null, sig, false, wrapExceptions);
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override MethodBody? GetMethodBody()
         {
             RuntimeMethodBody? mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
@@ -384,7 +383,6 @@ namespace System.Reflection
                 mb._methodBase = this;
             return mb;
         }
-#pragma warning restore CS8609
 
         public override bool IsSecurityCritical
         {
index 7ff457b..4378c49 100644 (file)
@@ -394,7 +394,6 @@ namespace System.Reflection
             }
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override MethodBody? GetMethodBody()
         {
             RuntimeMethodBody? mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
@@ -402,7 +401,6 @@ namespace System.Reflection
                 mb._methodBase = this;
             return mb;
         }
-#pragma warning restore CS8609
 
         #endregion
 
@@ -522,16 +520,9 @@ namespace System.Reflection
             get { return ReturnParameter; }
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
-        public override ParameterInfo ReturnParameter
-        {
-            get
-            {
-                FetchReturnParameter();
-                return (m_returnParameter as ParameterInfo)!;
-            }
-        }
-#pragma warning restore CS8609
+#pragma warning disable CS6809 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
+        public override ParameterInfo ReturnParameter => FetchReturnParameter();
+#pragma warning restore CS6809
 
         public override bool IsCollectible => (RuntimeMethodHandle.GetIsCollectible(new RuntimeMethodHandleInternal(m_handle)) != Interop.BOOL.FALSE);
 
index 6555a5a..6386327 100644 (file)
@@ -1545,15 +1545,15 @@ namespace System
         }
 
         // ILHeader info
-        internal abstract RuntimeType GetJitContext(out int securityControlFlags);
+        internal abstract RuntimeType? GetJitContext(out int securityControlFlags);
         internal abstract byte[] GetCodeInfo(out int stackSize, out int initLocals, out int EHCount);
         internal abstract byte[] GetLocalsSignature();
         internal abstract unsafe void GetEHInfo(int EHNumber, void* exception);
-        internal abstract byte[] GetRawEHInfo();
+        internal abstract byte[]? GetRawEHInfo();
         // token resolution
-        internal abstract string GetStringLiteral(int token);
+        internal abstract string? GetStringLiteral(int token);
         internal abstract void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle);
-        internal abstract byte[] ResolveSignature(int token, int fromMethod);
+        internal abstract byte[]? ResolveSignature(int token, int fromMethod);
         //
         internal abstract MethodInfo GetDynamicMethod();
     }
index 34edc8f..405b88b 100644 (file)
@@ -88,7 +88,7 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern int GetHashCodeOfPtr(IntPtr ptr);
 
-        public override string ToString()
+        public override string? ToString()
         {
             return this.GetType().ToString();
         }
index 6412676..b316cf9 100644 (file)
@@ -3521,19 +3521,19 @@ namespace System.Diagnostics.Tracing
             if (!reflectionOnly && (staticFieldType == typeof(EventOpcode)) || AttributeTypeNamesMatch(staticFieldType, typeof(EventOpcode)))
             {
                 if (providerEnumKind != "Opcodes") goto Error;
-                int value = (int)staticField.GetRawConstantValue();
+                int value = (int)staticField.GetRawConstantValue()!;
                 manifest.AddOpcode(staticField.Name, value);
             }
             else if (!reflectionOnly && (staticFieldType == typeof(EventTask)) || AttributeTypeNamesMatch(staticFieldType, typeof(EventTask)))
             {
                 if (providerEnumKind != "Tasks") goto Error;
-                int value = (int)staticField.GetRawConstantValue();
+                int value = (int)staticField.GetRawConstantValue()!;
                 manifest.AddTask(staticField.Name, value);
             }
             else if (!reflectionOnly && (staticFieldType == typeof(EventKeywords)) || AttributeTypeNamesMatch(staticFieldType, typeof(EventKeywords)))
             {
                 if (providerEnumKind != "Keywords") goto Error;
-                ulong value = unchecked((ulong)(long)staticField.GetRawConstantValue());
+                ulong value = unchecked((ulong)(long)staticField.GetRawConstantValue()!);
                 manifest.AddKeyword(staticField.Name, value);
             }
 #if FEATURE_MANAGED_ETW_CHANNELS && FEATURE_ADVANCED_MANAGED_ETW_CHANNELS
@@ -3730,7 +3730,7 @@ namespace System.Diagnostics.Tracing
 #if ES_BUILD_STANDALONE
             (new ReflectionPermission(ReflectionPermissionFlag.MemberAccess)).Assert();
 #endif
-            byte[] instrs = method.GetMethodBody().GetILAsByteArray()!;
+            byte[] instrs = method.GetMethodBody()!.GetILAsByteArray()!;
             int retVal = -1;
             for (int idx = 0; idx < instrs.Length;)
             {
@@ -5828,7 +5828,7 @@ namespace System.Diagnostics.Tracing
                     bool anyValuesWritten = false;
                     foreach (FieldInfo staticField in staticFields)
                     {
-                        object constantValObj = staticField.GetRawConstantValue();
+                        object? constantValObj = staticField.GetRawConstantValue();
 
                         if (constantValObj != null)
                         {
index 8d308a7..a347696 100644 (file)
@@ -71,12 +71,10 @@ namespace System
             return hasValue ? value.GetHashCode() : 0;
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override string? ToString()
         {
             return hasValue ? value.ToString() : "";
         }
-#pragma warning restore CS8609
 
         [NonVersionable]
         public static implicit operator Nullable<T>(T value)
index aa9cd55..569c5f5 100644 (file)
@@ -119,7 +119,7 @@ namespace System.Reflection
 
         public virtual event ModuleResolveEventHandler ModuleResolve { add { throw NotImplemented.ByDesign; } remove { throw NotImplemented.ByDesign; } }
 
-        public virtual Module? ManifestModule { get { throw NotImplemented.ByDesign; } }
+        public virtual Module ManifestModule { get { throw NotImplemented.ByDesign; } }
         public virtual Module? GetModule(string name) { throw NotImplemented.ByDesign; }
 
         public Module[] GetModules() => GetModules(getResourceModules: false);
index 9bc3ea0..3de53a1 100644 (file)
@@ -226,7 +226,7 @@ namespace System.Reflection
                 if (this.Name == null)
                     return string.Empty;
                 // Do not call GetPublicKeyToken() here - that latches the result into AssemblyName which isn't a side effect we want.
-                byte[] pkt = _publicKeyToken ?? ComputePublicKeyToken();
+                byte[]? pkt = _publicKeyToken ?? ComputePublicKeyToken();
                 return AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, pkt, Flags, ContentType);
             }
         }
index ee30573..42d280c 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Reflection
         public override string ToString()
         {
             if (m_memberInfo == null)
-                return base.ToString();
+                return base.ToString()!;
 
             return string.Format("{0} = {1}", MemberInfo.Name, TypedValue.ToString(ArgumentType != typeof(object)));
         }
index 7ccdbe5..6247d73 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Reflection
         internal string ToString(bool typed)
         {
             if (m_argumentType == null)
-                return base.ToString();
+                return base.ToString()!;
 
             if (ArgumentType.IsEnum)
                 return string.Format(typed ? "{0}" : "({1}){0}", Value, ArgumentType.FullName);
index b9b799d..a2d5792 100644 (file)
@@ -183,11 +183,9 @@ namespace System.Reflection.Emit
             return Value;
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         public override string? ToString()
         {
             return Name;
         }
-#pragma warning restore CS8609
     }
 }
index 7af1c78..cbb04d5 100644 (file)
@@ -72,9 +72,9 @@ namespace System.Reflection
         [CLSCompliant(false)]
         public virtual void SetValueDirect(TypedReference obj, object value) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
         [CLSCompliant(false)]
-        public virtual object GetValueDirect(TypedReference obj) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
+        public virtual object? GetValueDirect(TypedReference obj) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
 
-        public virtual object GetRawConstantValue() { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
+        public virtual object? GetRawConstantValue() { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
 
         public virtual Type[] GetOptionalCustomModifiers() { throw NotImplemented.ByDesign; }
         public virtual Type[] GetRequiredCustomModifiers() { throw NotImplemented.ByDesign; }
index dcc2682..96ca09c 100644 (file)
@@ -16,7 +16,7 @@ namespace System.Reflection
         public abstract MethodAttributes Attributes { get; }
         public virtual MethodImplAttributes MethodImplementationFlags => GetMethodImplementationFlags();
         public abstract MethodImplAttributes GetMethodImplementationFlags();
-        public virtual MethodBody GetMethodBody() { throw new InvalidOperationException(); }
+        public virtual MethodBody? GetMethodBody() { throw new InvalidOperationException(); }
         public virtual CallingConventions CallingConvention => CallingConventions.Standard;
 
         public bool IsAbstract => (Attributes & MethodAttributes.Abstract) != 0;
index 24c756e..f275fd9 100644 (file)
@@ -256,7 +256,7 @@ namespace System.Threading.Tasks
 #if PROJECTN
         [DependencyReductionRoot]
 #endif
-        internal abstract Delegate[] GetDelegateContinuationsForDebugger();
+        internal abstract Delegate[]? GetDelegateContinuationsForDebugger();
     }
 
     /// <summary>Provides the standard implementation of a task continuation.</summary>
@@ -341,7 +341,6 @@ namespace System.Threading.Tasks
             else continuationTask.InternalCancel(false);
         }
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         internal override Delegate[]? GetDelegateContinuationsForDebugger()
         {
             if (m_task.m_action == null)
@@ -351,7 +350,6 @@ namespace System.Threading.Tasks
 
             return new Delegate[] { m_task.m_action };
         }
-#pragma warning restore CS8609
 
     }
 
index 1238009..75c6fd9 100644 (file)
@@ -776,7 +776,6 @@ namespace System.Threading.Tasks
         public ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) =>
             new ConfiguredValueTaskAwaitable<TResult>(new ValueTask<TResult>(_obj, _result, _token, continueOnCapturedContext));
 
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
         /// <summary>Gets a string-representation of this <see cref="ValueTask{TResult}"/>.</summary>
         public override string? ToString()
         {
@@ -791,6 +790,5 @@ namespace System.Threading.Tasks
 
             return string.Empty;
         }
-#pragma warning restore CS8609
     }
 }
index ac610e8..308b57a 100644 (file)
@@ -121,7 +121,7 @@ namespace System
             for (int i = 0; i < flds.Length; i++)
             {
                 names[i] = flds[i].Name;
-                values[i] = flds[i].GetRawConstantValue();
+                values[i] = flds[i].GetRawConstantValue()!;
             }
 
             // Insertion Sort these values in ascending order.