From 18404453b0b9d4c7ee3b73df203c6a7e26ee2505 Mon Sep 17 00:00:00 2001 From: slozier Date: Tue, 26 Nov 2024 22:09:07 -0500 Subject: [PATCH] Revert "Fix for missing trace event on first expression (#281)" This reverts commit ce7ce749f4693b5bfd766b8b2f6867fced6b3887. --- .github/workflows/main.yml | 14 +++++++------- Directory.Build.props | 2 +- .../Debugging/DebugInfoRewriter.cs | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a1c1fdfc..656679d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,21 +13,21 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest-large] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - name: Setup .NET Core 3.1 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v1 with: dotnet-version: '3.1.x' - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v1 with: dotnet-version: '6.0.x' - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v1 with: dotnet-version: '8.0.x' - name: Setup .NET 9.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v1 with: dotnet-version: '9.0.x' include-prerelease: true @@ -35,9 +35,9 @@ jobs: run: pwsh make.ps1 - name: Package run: pwsh make.ps1 package - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v2 with: - name: packages-${{ matrix.os }} + name: packages path: Package/Release/Packages - name: Test (net462) run: ./make.ps1 -frameworks net462 test-all diff --git a/Directory.Build.props b/Directory.Build.props index eebef0c4..a9c79692 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -94,7 +94,7 @@ - true + false portable true false diff --git a/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs b/Src/Microsoft.Dynamic/Debugging/DebugInfoRewriter.cs index 17496e1d..838465e3 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,12 +355,17 @@ protected override MSAst.Expression VisitDebugInfo(MSAst.DebugInfoExpression nod // Update the location cookie int locationCookie = _locationCookie++; if (!_transformToGenerator) { - var tracebackCall = Ast.Call( - typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.OnTraceEvent)), - _thread, - AstUtils.Constant(locationCookie), - Ast.Convert(Ast.Constant(null), typeof(Exception)) - ); + 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)) + ); + } transformedExpression = Ast.Block( Ast.Assign(