1
- // Copyright (c) Microsoft Corporation .
2
- // Licensed under the MIT License.
1
+ // Copyright (c) Ben A Adams. All rights reserved .
2
+ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information .
3
3
4
4
using System . Reflection ;
5
5
6
+ #nullable enable
7
+
6
8
namespace System . Diagnostics
7
9
{
8
10
/// <nodoc />
9
- public class EnhancedStackFrame : StackFrame
11
+ internal class EnhancedStackFrame : StackFrame
10
12
{
11
- private readonly string _fileName ;
13
+ private readonly string ? _fileName ;
12
14
private readonly int _lineNumber ;
13
15
private readonly int _colNumber ;
14
16
15
- /// <nodoc />
16
17
public StackFrame StackFrame { get ; }
17
18
18
- /// <nodoc />
19
+ public bool IsRecursive
20
+ {
21
+ get => MethodInfo . RecurseCount > 0 ;
22
+ internal set => MethodInfo . RecurseCount ++ ;
23
+ }
24
+
19
25
public ResolvedMethod MethodInfo { get ; }
20
26
21
- internal EnhancedStackFrame ( StackFrame stackFrame , ResolvedMethod methodInfo , string fileName , int lineNumber , int colNumber )
27
+ internal EnhancedStackFrame ( StackFrame stackFrame , ResolvedMethod methodInfo , string ? fileName , int lineNumber , int colNumber )
22
28
: base ( fileName , lineNumber , colNumber )
23
29
{
24
30
StackFrame = stackFrame ;
@@ -29,6 +35,14 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
29
35
_colNumber = colNumber ;
30
36
}
31
37
38
+ internal bool IsEquivalent ( ResolvedMethod methodInfo , string ? fileName , int lineNumber , int colNumber )
39
+ {
40
+ return _lineNumber == lineNumber &&
41
+ _colNumber == colNumber &&
42
+ _fileName == fileName &&
43
+ MethodInfo . IsSequentialEquivalent ( methodInfo ) ;
44
+ }
45
+
32
46
/// <summary>
33
47
/// Gets the column number in the file that contains the code that is executing.
34
48
/// This information is typically extracted from the debugging symbols for the executable.
@@ -48,7 +62,7 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
48
62
/// This information is typically extracted from the debugging symbols for the executable.
49
63
/// </summary>
50
64
/// <returns>The file name, or null if the file name cannot be determined.</returns>
51
- public override string GetFileName ( ) => _fileName ;
65
+ public override string ? GetFileName ( ) => _fileName ;
52
66
53
67
/// <summary>
54
68
/// Gets the offset from the start of the Microsoft intermediate language (MSIL)
@@ -63,7 +77,7 @@ internal EnhancedStackFrame(StackFrame stackFrame, ResolvedMethod methodInfo, st
63
77
/// Gets the method in which the frame is executing.
64
78
/// </summary>
65
79
/// <returns>The method in which the frame is executing.</returns>
66
- public override MethodBase GetMethod ( ) => StackFrame . GetMethod ( ) ;
80
+ public override MethodBase ? GetMethod ( ) => StackFrame . GetMethod ( ) ;
67
81
68
82
/// <summary>
69
83
/// Gets the offset from the start of the native just-in-time (JIT)-compiled code
0 commit comments