From 544afc00789717fbbdf5c9ad2061d6dce22cc9db Mon Sep 17 00:00:00 2001 From: Huei Feng <34702552+hueifeng@users.noreply.github.com> Date: Thu, 4 Jun 2020 00:54:10 +0800 Subject: [PATCH] Added `#nullable enable` with `StackTraceHelper` (#22419) * Added `#nullable enable` with `StackTraceHelper` --- src/Shared/StackTrace/StackFrame/StackTraceHelper.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Shared/StackTrace/StackFrame/StackTraceHelper.cs b/src/Shared/StackTrace/StackFrame/StackTraceHelper.cs index 48f72438eb..27aaf67ea1 100644 --- a/src/Shared/StackTrace/StackFrame/StackTraceHelper.cs +++ b/src/Shared/StackTrace/StackFrame/StackTraceHelper.cs @@ -10,12 +10,13 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using Microsoft.Extensions.Internal; +#nullable enable namespace Microsoft.Extensions.StackTrace.Sources { internal class StackTraceHelper { - public static IList GetFrames(Exception exception, out AggregateException error) + public static IList GetFrames(Exception exception, out AggregateException? error) { var frames = new List(); @@ -35,7 +36,7 @@ namespace Microsoft.Extensions.StackTrace.Sources return frames; } - List exceptions = null; + List? exceptions = null; for (var i = 0; i < stackFrames.Length; i++) { @@ -69,7 +70,7 @@ namespace Microsoft.Extensions.StackTrace.Sources return frames; } - internal static MethodDisplayInfo GetMethodDisplayString(MethodBase method) + internal static MethodDisplayInfo? GetMethodDisplayString(MethodBase? method) { // Special case: no method available if (method == null) @@ -145,7 +146,7 @@ namespace Microsoft.Extensions.StackTrace.Sources return methodDisplayInfo; } - private static bool ShowInStackTrace(MethodBase method) + private static bool ShowInStackTrace(MethodBase? method) { Debug.Assert(method != null); @@ -191,7 +192,7 @@ namespace Microsoft.Extensions.StackTrace.Sources return true; } - private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType) + private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type? declaringType) { Debug.Assert(method != null); Debug.Assert(method.DeclaringType != null);