@@ -7,15 +7,21 @@ namespace System.Diagnostics
77{
88 public class EnhancedStackFrame : StackFrame
99 {
10- private string _fileName ;
11- private int _lineNumber ;
12- private int _colNumber ;
10+ private readonly string ? _fileName ;
11+ private readonly int _lineNumber ;
12+ private readonly int _colNumber ;
1313
1414 public StackFrame StackFrame { get ; }
1515
16+ public bool IsRecursive
17+ {
18+ get => MethodInfo . RecurseCount > 0 ;
19+ internal set => MethodInfo . RecurseCount ++ ;
20+ }
21+
1622 public ResolvedMethod MethodInfo { get ; }
1723
18- internal EnhancedStackFrame ( StackFrame stackFrame , ResolvedMethod methodInfo , string fileName , int lineNumber , int colNumber )
24+ internal EnhancedStackFrame ( StackFrame stackFrame , ResolvedMethod methodInfo , string ? fileName , int lineNumber , int colNumber )
1925 : base ( fileName , lineNumber , colNumber )
2026 {
2127 StackFrame = stackFrame ;
@@ -26,6 +32,14 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
2632 _colNumber = colNumber ;
2733 }
2834
35+ internal bool IsEquivalent ( ResolvedMethod methodInfo , string ? fileName , int lineNumber , int colNumber )
36+ {
37+ return _lineNumber == lineNumber &&
38+ _colNumber == colNumber &&
39+ _fileName == fileName &&
40+ MethodInfo . IsSequentialEquivalent ( methodInfo ) ;
41+ }
42+
2943 /// <summary>
3044 /// Gets the column number in the file that contains the code that is executing.
3145 /// This information is typically extracted from the debugging symbols for the executable.
@@ -45,7 +59,7 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
4559 /// This information is typically extracted from the debugging symbols for the executable.
4660 /// </summary>
4761 /// <returns>The file name, or null if the file name cannot be determined.</returns>
48- public override string GetFileName ( ) => _fileName ;
62+ public override string ? GetFileName ( ) => _fileName ;
4963
5064 /// <summary>
5165 /// Gets the offset from the start of the Microsoft intermediate language (MSIL)
@@ -60,7 +74,7 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
6074 /// Gets the method in which the frame is executing.
6175 /// </summary>
6276 /// <returns>The method in which the frame is executing.</returns>
63- public override MethodBase GetMethod ( ) => StackFrame . GetMethod ( ) ;
77+ public override MethodBase ? GetMethod ( ) => StackFrame . GetMethod ( ) ;
6478
6579 /// <summary>
6680 /// Gets the offset from the start of the native just-in-time (JIT)-compiled code
0 commit comments