summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System')
-rw-r--r--src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs10
-rw-r--r--src/System.Private.CoreLib/shared/System/Nullable.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Type.Enum.cs2
12 files changed, 14 insertions, 22 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
index 6412676f26..b316cf936a 100644
--- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
+++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
@@ -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)
{
diff --git a/src/System.Private.CoreLib/shared/System/Nullable.cs b/src/System.Private.CoreLib/shared/System/Nullable.cs
index 8d308a758d..a347696458 100644
--- a/src/System.Private.CoreLib/shared/System/Nullable.cs
+++ b/src/System.Private.CoreLib/shared/System/Nullable.cs
@@ -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)
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs b/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs
index aa9cd55055..569c5f5c8c 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs
@@ -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);
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs
index 9bc3ea099f..3de53a1419 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs
@@ -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);
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs b/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs
index ee30573b76..42d280ccd9 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs
@@ -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)));
}
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs b/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs
index 7ccdbe5ba4..6247d73fb8 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs
@@ -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);
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs
index b9b799d2f3..a2d5792c6a 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs
@@ -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
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs b/src/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs
index 7af1c782f1..cbb04d54a4 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs
@@ -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; }
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs b/src/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs
index dcc268228e..96ca09cf35 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs
@@ -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;
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs
index 24c756e34d..f275fd9549 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs
@@ -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
}
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs
index 123800914b..75c6fd9a32 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs
@@ -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
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Type.Enum.cs b/src/System.Private.CoreLib/shared/System/Type.Enum.cs
index ac610e8484..308b57aefe 100644
--- a/src/System.Private.CoreLib/shared/System/Type.Enum.cs
+++ b/src/System.Private.CoreLib/shared/System/Type.Enum.cs
@@ -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.