Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions csharp/codeql-extractor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ column_kind: "utf16"
overlay_support_version: 20250626
extra_env_vars:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
# The MSBuild server may have been started outside the traced build.
DOTNET_CLI_USE_MSBUILD_SERVER: "false"
MSBUILDDISABLENODEREUSE: "1"
build_modes:
- autobuild
- manual
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<Target Name="CheckMSBuildServer">
<Error Condition="'$(DOTNET_CLI_USE_MSBUILD_SERVER)' != 'false'"
Text="Expected the .NET CLI MSBuild server to be disabled during CodeQL tracing." />
<Error Condition="'$(MSBUILDDISABLENODEREUSE)' != '1'"
Text="Expected MSBuild node reuse to be disabled during CodeQL tracing." />
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import os
import pytest

def check_build_out(msg, s):
lines = s.splitlines()
assert (
any (("[build-stdout]" in line) and (msg in line) for line in lines)
), f"The C# tracer did not interpret the dotnet path-to-application command correctly."

def test1(codeql, csharp):
codeql.database.create(command="dotnet build")
@pytest.mark.parametrize("command", ["build", "msbuild -restore", "publish", "pack"])
def test1(codeql, csharp, command):
codeql.database.create(
command=f"dotnet {command} -t:Build,CheckMSBuildServer",
)


# This test checks that we don't inject any flags when running the application using `dotnet`
Expand Down
4 changes: 4 additions & 0 deletions csharp/ql/lib/change-notes/2026-11-26-msbuild-tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: fix
---
* Disabled MSBuild server and node reuse by default during C# traced builds to improve extraction reliability.
Loading