diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/CompilerVersion.cs b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/CompilerVersion.cs
index e52c79a17e19..5429f2bba075 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/CompilerVersion.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/CompilerVersion.cs
@@ -74,7 +74,9 @@ public CompilerVersion(Options options)
specifiedFramework = compilerDir;
}
- var versionInfo = FileVersionInfo.GetVersionInfo(SpecifiedCompiler);
+ // If csc is specified as compiler name, then attempt to read the version information from csc.dll
+ var compilerBinaryName = Path.GetFileName(SpecifiedCompiler) == "csc" ? $"{SpecifiedCompiler}.dll" : SpecifiedCompiler;
+ var versionInfo = FileVersionInfo.GetVersionInfo(File.Exists(compilerBinaryName) ? compilerBinaryName : SpecifiedCompiler);
if (!knownCompilerNames.TryGetValue(versionInfo.OriginalFilename ?? string.Empty, out var vendor))
{
SkipExtractionBecause("the compiler name is not recognised");
diff --git a/csharp/ql/integration-tests/linux/dotnet_10_rc2/Program.cs b/csharp/ql/integration-tests/linux/dotnet_10_rc2/Program.cs
new file mode 100644
index 000000000000..bd44629f7e23
--- /dev/null
+++ b/csharp/ql/integration-tests/linux/dotnet_10_rc2/Program.cs
@@ -0,0 +1 @@
+Console.WriteLine($"{string.Join(",", args)}");
diff --git a/csharp/ql/integration-tests/linux/dotnet_10_rc2/dotnet_build.csproj b/csharp/ql/integration-tests/linux/dotnet_10_rc2/dotnet_build.csproj
new file mode 100644
index 000000000000..dfb40caafcf9
--- /dev/null
+++ b/csharp/ql/integration-tests/linux/dotnet_10_rc2/dotnet_build.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/csharp/ql/integration-tests/linux/dotnet_10_rc2/global.json b/csharp/ql/integration-tests/linux/dotnet_10_rc2/global.json
new file mode 100644
index 000000000000..e870e2cf7bdd
--- /dev/null
+++ b/csharp/ql/integration-tests/linux/dotnet_10_rc2/global.json
@@ -0,0 +1,5 @@
+{
+ "sdk": {
+ "version": "10.0.100-rc.2.25502.107"
+ }
+}
diff --git a/csharp/ql/integration-tests/linux/dotnet_10_rc2/test.py b/csharp/ql/integration-tests/linux/dotnet_10_rc2/test.py
new file mode 100644
index 000000000000..148626b1cb86
--- /dev/null
+++ b/csharp/ql/integration-tests/linux/dotnet_10_rc2/test.py
@@ -0,0 +1,6 @@
+import os
+import runs_on
+
+@runs_on.linux
+def test(codeql, csharp):
+ codeql.database.create()
diff --git a/csharp/ql/integration-tests/windows/dotnet_10_rc2/Program.cs b/csharp/ql/integration-tests/windows/dotnet_10_rc2/Program.cs
new file mode 100644
index 000000000000..bd44629f7e23
--- /dev/null
+++ b/csharp/ql/integration-tests/windows/dotnet_10_rc2/Program.cs
@@ -0,0 +1 @@
+Console.WriteLine($"{string.Join(",", args)}");
diff --git a/csharp/ql/integration-tests/windows/dotnet_10_rc2/dotnet_build.csproj b/csharp/ql/integration-tests/windows/dotnet_10_rc2/dotnet_build.csproj
new file mode 100644
index 000000000000..dfb40caafcf9
--- /dev/null
+++ b/csharp/ql/integration-tests/windows/dotnet_10_rc2/dotnet_build.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/csharp/ql/integration-tests/windows/dotnet_10_rc2/global.json b/csharp/ql/integration-tests/windows/dotnet_10_rc2/global.json
new file mode 100644
index 000000000000..e870e2cf7bdd
--- /dev/null
+++ b/csharp/ql/integration-tests/windows/dotnet_10_rc2/global.json
@@ -0,0 +1,5 @@
+{
+ "sdk": {
+ "version": "10.0.100-rc.2.25502.107"
+ }
+}
diff --git a/csharp/ql/integration-tests/windows/dotnet_10_rc2/test.py b/csharp/ql/integration-tests/windows/dotnet_10_rc2/test.py
new file mode 100644
index 000000000000..00905b67cd49
--- /dev/null
+++ b/csharp/ql/integration-tests/windows/dotnet_10_rc2/test.py
@@ -0,0 +1,6 @@
+import os
+import runs_on
+
+@runs_on.windows
+def test(codeql, csharp):
+ codeql.database.create()
diff --git a/csharp/ql/lib/change-notes/2025-10-21-dotnet-rc2-tracing.md b/csharp/ql/lib/change-notes/2025-10-21-dotnet-rc2-tracing.md
new file mode 100644
index 000000000000..b54f1e7d1b5d
--- /dev/null
+++ b/csharp/ql/lib/change-notes/2025-10-21-dotnet-rc2-tracing.md
@@ -0,0 +1,4 @@
+---
+category: minorAnalysis
+---
+* Added tracer support for macOS and Linux when the .NET CLI (`dotnet`) directly invokes the C# compiler (`csc`). This enhancement provides basic tracing and extraction capabilities for .NET 10 RC2 on these platforms.
diff --git a/csharp/tools/tracing-config.lua b/csharp/tools/tracing-config.lua
index a48a93c073c8..13ede12a237e 100644
--- a/csharp/tools/tracing-config.lua
+++ b/csharp/tools/tracing-config.lua
@@ -221,9 +221,9 @@ function RegisterExtractorPack(id)
}
local posixMatchers = {
DotnetMatcherBuild,
- CreatePatternMatcher({ '^mcs%.exe$', '^csc%.exe$' }, MatchCompilerName,
+ CreatePatternMatcher({ '^mcs%.exe$', '^csc%.exe$', '^csc$' }, MatchCompilerName,
extractor, {
- prepend = { '--compiler', '"${compiler}"' },
+ prepend = { '--compiler', '${compiler}' },
order = ORDER_BEFORE
}),
MsBuildMatcher,