Skip to content

Commit ed8885f

Browse files
authored
Update Demystifier (#248)
* Update Demystifier * Try upping lang version * Update package
1 parent 6fb1f94 commit ed8885f

14 files changed

+365
-174
lines changed

build/common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Authors>Exceptionless</Authors>
1212
<NoWarn>$(NoWarn);CS1591;NU1701</NoWarn>
1313
<WarningsAsErrors>true</WarningsAsErrors>
14-
<LangVersion>latest</LangVersion>
14+
<LangVersion>preview</LangVersion>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1616
<PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath>
1717
<PackageIcon>exceptionless-icon.png</PackageIcon>

src/Exceptionless/Demystifier/EnhancedStackFrame.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)