Skip to content

Reset CodeQL pipeline and apply dotnet-host-probe SDK drive-casing workaround (#9371)#9373

Closed
Evangelink wants to merge 3 commits into
mainfrom
dev/amauryleve/codeql-reset-sdkroot-workaround
Closed

Reset CodeQL pipeline and apply dotnet-host-probe SDK drive-casing workaround (#9371)#9373
Evangelink wants to merge 3 commits into
mainfrom
dev/amauryleve/codeql-reset-sdkroot-workaround

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Resets azure-pipelines-codeql.yml to its state at commit 5857015 and applies the SDK drive-casing workaround fix from #9371.

Changes

  1. azure-pipelines-codeql.yml — reset to commit 5857015, dropping the temporary MSBuild node-communication diagnostics (MSBUILDDEBUGCOMM/MSBUILDDEBUGPATH env vars, the debug-folder prep step, and the PublishBuildArtifacts steps).

  2. eng/Versions.props — replaces the LoadLibraryEx-based #14026 NetCoreSdkRoot drive-casing workaround with the dotnet-host-probe implementation from Work around MSB4216 NET task host drive-casing failure in CodeQL build #9371. The new version learns the canonical drive-letter casing by launching the SDK's dotnet.exe and reading GetModuleFileNameW(NULL), caches the result per-process, and adds the NetCoreSdkRootDriveCasingOverride (lower/upper) and DisableNetCoreSdkRootDriveCasingWorkaround knobs. Version numbers are unchanged.

Evangelink and others added 3 commits June 10, 2026 12:53
Set MSBUILDDEBUGCOMM=1 and MSBUILDDEBUGPATH to artifacts/msbuild-debug for the Windows Build step, then publish the contents of that folder along with the build binlogs as pipeline artifacts so the MSBuild team can investigate the reported issue (cc Rainer Sigwald).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous attempt put the SDK-root drive-casing workaround in
Directory.Build.targets, but the Arcade orchestrator/toolset project — which is
where the cross-runtime task-host handshake first fires (InstallDotNetCore etc.)
— does NOT import the repo's Directory.Build.targets. It DOES import
eng/Versions.props via the Arcade SDK chain, so moving the InitialTargets +
UsingTask + Target there makes the target actually run before the first .NET
task host launch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g workaround

Reset azure-pipelines-codeql.yml to its state at 5857015 (drop the MSBuild
node-communication diagnostics) and replace the LoadLibraryEx-based #14026
NetCoreSdkRoot drive-casing workaround in eng/Versions.props with the
dotnet-host-probe implementation from #9371.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 23, 2026 13:11
@Evangelink Evangelink closed this Jun 23, 2026
@Evangelink Evangelink deleted the dev/amauryleve/codeql-reset-sdkroot-workaround branch June 23, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts repository build infrastructure to (1) restore the CodeQL Azure Pipelines definition to an earlier baseline and (2) add a temporary MSBuild workaround to normalize $(NetCoreSdkRoot) drive-letter casing to avoid intermittent MSB4216 task-host handshake failures on some Windows agents.

Changes:

  • Reset azure-pipelines-codeql.yml by removing temporary diagnostics and related documentation.
  • Add a Windows/.NET Framework-only NormalizeNetCoreSdkRootCasing initial target in eng/Versions.props that probes the canonical drive-letter casing by launching dotnet.exe and reading GetModuleFileNameW(NULL).
  • Introduce knobs DisableNetCoreSdkRootDriveCasingWorkaround and NetCoreSdkRootDriveCasingOverride=lower|upper (as described in PR metadata).
Show a summary per file
File Description
eng/Versions.props Adds an inline RoslynCodeTaskFactory task + initial target to normalize $(NetCoreSdkRoot) drive casing and avoid MSB4216; also changes several pinned version properties.
azure-pipelines-codeql.yml Removes a cautionary comment block about avoiding UseDotNet@2 useGlobalJson in this pipeline.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 4

Comment thread eng/Versions.props
Comment on lines +246 to +255
using (var p = Process.Start(psi))
{
string stdout = p.StandardOutput.ReadToEnd();
string stderr = p.StandardError.ReadToEnd();
if (!p.WaitForExit(120000))
{
try { p.Kill(); } catch { }
Log.LogMessage(MessageImportance.Low, "NormalizeSdkRootDriveCasing: probe timed out launching '{0}'.", dotnetExe);
return '\0';
}
Comment thread eng/Versions.props
// Returns '\0' if it cannot be determined.
private char GetRegisteredSdkDrive(string sdkRoot)
{
char driveKey = sdkRoot[0];
Comment thread eng/Versions.props
Comment on lines +10 to +14
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>11.0.0-beta.26310.1</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
<MicrosoftTestingExtensionsCodeCoverageVersion>18.9.0-preview.26310.1</MicrosoftTestingExtensionsCodeCoverageVersion>
<!-- empty line to avoid merge conflicts for darc PRs to update CC and MSTest+MTP -->
<MSTestVersion>4.3.0-preview.26309.6</MSTestVersion>
<MicrosoftTestingPlatformVersion>2.3.0-preview.26309.6</MicrosoftTestingPlatformVersion>
<MSTestVersion>4.3.0-preview.26310.6</MSTestVersion>
<MicrosoftTestingPlatformVersion>2.3.0-preview.26310.6</MicrosoftTestingPlatformVersion>
Comment on lines 49 to 51
steps:

# NOTE: Do not add an explicit `UseDotNet@2` with `useGlobalJson: true` here.
# global.json pins a preview SDK (11.0.x-preview.*) and the `UseDotNet@2` task
# does not search preview channels by default, so it fails with
# "sdk version matching: 11.0.x could not be found". `eng\common\cibuild.cmd`
# (invoked below) restores the correct SDK from global.json via `dotnet-install.ps1`,
# which handles preview versions correctly.

- task: PowerShell@2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants