From ce7ce749f4693b5bfd766b8b2f6867fced6b3887 Mon Sep 17 00:00:00 2001 From: slozier Date: Tue, 26 Nov 2024 21:26:48 -0500 Subject: [PATCH 1/2] Fix for missing trace event on first expression (#281) * Fix for missing trace event on first expression * Update build actions * Fix packaging * Fix packaging --- .github/workflows/main.yml | 14 +++++++------- Directory.Build.props | 2 +- .../Debugging/DebugInfoRewriter.cs | 19 +++++++------------ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 656679d8..a1c1fdfc 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@v2 + - uses: actions/checkout@v4 - name: Setup .NET Core 3.1 - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '3.1.x' - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '6.0.x' - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' - name: Setup .NET 9.0 - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 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@v2 + - uses: actions/upload-artifact@v4 with: - name: packages + name: packages-${{ matrix.os }} 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 a9c79692..eebef0c4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -94,7 +94,7 @@ - false + true portable true false 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( From ccc60e511c08a701e79540a43298212ecd8c57d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Tue, 26 Nov 2024 22:09:53 -0500 Subject: [PATCH 2/2] Revert fix --- .../Debugging/DebugInfoRewriter.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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(