Skip to content

Commit 544afc0

Browse files
authored
Added #nullable enable with StackTraceHelper (#22419)
* Added `#nullable enable` with `StackTraceHelper`
1 parent 77ef004 commit 544afc0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Shared/StackTrace/StackFrame/StackTraceHelper.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
using System.Runtime.CompilerServices;
1111
using System.Runtime.ExceptionServices;
1212
using Microsoft.Extensions.Internal;
13+
#nullable enable
1314

1415
namespace Microsoft.Extensions.StackTrace.Sources
1516
{
1617
internal class StackTraceHelper
1718
{
18-
public static IList<StackFrameInfo> GetFrames(Exception exception, out AggregateException error)
19+
public static IList<StackFrameInfo> GetFrames(Exception exception, out AggregateException? error)
1920
{
2021
var frames = new List<StackFrameInfo>();
2122

@@ -35,7 +36,7 @@ public static IList<StackFrameInfo> GetFrames(Exception exception, out Aggregate
3536
return frames;
3637
}
3738

38-
List<Exception> exceptions = null;
39+
List<Exception>? exceptions = null;
3940

4041
for (var i = 0; i < stackFrames.Length; i++)
4142
{
@@ -69,7 +70,7 @@ public static IList<StackFrameInfo> GetFrames(Exception exception, out Aggregate
6970
return frames;
7071
}
7172

72-
internal static MethodDisplayInfo GetMethodDisplayString(MethodBase method)
73+
internal static MethodDisplayInfo? GetMethodDisplayString(MethodBase? method)
7374
{
7475
// Special case: no method available
7576
if (method == null)
@@ -145,7 +146,7 @@ internal static MethodDisplayInfo GetMethodDisplayString(MethodBase method)
145146
return methodDisplayInfo;
146147
}
147148

148-
private static bool ShowInStackTrace(MethodBase method)
149+
private static bool ShowInStackTrace(MethodBase? method)
149150
{
150151
Debug.Assert(method != null);
151152

@@ -191,7 +192,7 @@ private static bool ShowInStackTrace(MethodBase method)
191192
return true;
192193
}
193194

194-
private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType)
195+
private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type? declaringType)
195196
{
196197
Debug.Assert(method != null);
197198
Debug.Assert(method.DeclaringType != null);

0 commit comments

Comments
 (0)