Skip to content

Commit

Permalink
Fix for missing trace event on first expression
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Nov 27, 2024
1 parent fe26cf4 commit b32d781
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Microsoft.Scripting.Debugging {
using Ast = MSAst.Expression;
using System.Threading;

/// <summary>
/// Used to rewrite expressions containing DebugInfoExpressions.
/// </summary>
Expand Down Expand Up @@ -355,17 +355,12 @@ protected override MSAst.Expression VisitDebugInfo(MSAst.DebugInfoExpression nod
// Update the location cookie
int locationCookie = _locationCookie++;
if (!_transformToGenerator) {
MSAst.Expression tracebackCall = null;
if (locationCookie == 0) {
tracebackCall = Ast.Empty();
} else {
tracebackCall = Ast.Call(
typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.OnTraceEvent)),
_thread,
AstUtils.Constant(locationCookie),
Ast.Convert(Ast.Constant(null), typeof(Exception))
);
}
var tracebackCall = Ast.Call(
typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.OnTraceEvent)),
_thread,
AstUtils.Constant(locationCookie),
Ast.Convert(Ast.Constant(null), typeof(Exception))
);

transformedExpression = Ast.Block(
Ast.Assign(
Expand Down

0 comments on commit b32d781

Please sign in to comment.