From b32d781752203d0cf24564fe358cf29ffd99d063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Tue, 26 Nov 2024 20:38:40 -0500 Subject: [PATCH] Fix for missing trace event on first expression --- .../Debugging/DebugInfoRewriter.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs b/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs index 838465e3..17496e1d 100644 --- a/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs +++ b/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs @@ -17,7 +17,7 @@ namespace Microsoft.Scripting.Debugging { using Ast = MSAst.Expression; using System.Threading; - + /// /// Used to rewrite expressions containing DebugInfoExpressions. /// @@ -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(