Skip to content

Commit 2900a5d

Browse files
michaelnebelCopilot
andcommitted
C#: Disable MSBuild node reuse during tracing
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent dfd767d commit 2900a5d

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎csharp/codeql-extractor.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ column_kind: "utf16"
77
overlay_support_version: 20250626
88
extra_env_vars:
99
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
10+
# Reused MSBuild nodes may have been started outside the traced build.
11+
MSBUILDDISABLENODEREUSE: "1"
1012
build_modes:
1113
- autobuild
1214
- manual

‎csharp/ql/integration-tests/all-platforms/dotnet_build/dotnet_build.csproj‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

10+
<Target Name="CheckNodeReuse">
11+
<Error Condition="'$(MSBUILDDISABLENODEREUSE)' != '1'"
12+
Text="Expected MSBuild node reuse to be disabled during CodeQL tracing." />
13+
</Target>
14+
1015
</Project>

‎csharp/ql/integration-tests/all-platforms/dotnet_build/test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def check_build_out(msg, s):
77
), f"The C# tracer did not interpret the dotnet path-to-application command correctly."
88

99
def test1(codeql, csharp):
10-
codeql.database.create(command="dotnet build")
10+
codeql.database.create(command="dotnet build -t:Build,CheckNodeReuse")
1111

1212

1313
# This test checks that we don't inject any flags when running the application using `dotnet`

0 commit comments

Comments
 (0)