Skip to content

Add **/.dotnet/ to allowed binaries for nested SDK bootstrap dirs - #7105

Closed
lewing wants to merge 1 commit into
mainfrom
fix-binary-scan-dotnet-dir
Closed

lewing wants to merge 1 commit into
mainfrom
fix-binary-scan-dotnet-dir

Conversation

@lewing

@lewing lewing commented Jun 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds **/.dotnet/ to the allowed source-build binaries list to fix BinaryScan test failures on shortstack build legs.

Root Cause (verified from build logs)

SDK code flow PR #7064 (merged June 5) introduced src/sdk/eng/configure-toolset.sh, which calls dotnetup sdk install to pre-install a bootstrap SDK into src/sdk/.dotnet/. This directory never existed before — the passing build 2990093 (June 2) has zero references to src/sdk/.dotnet or configure-toolset in its logs.

In the first failing build 2993249 (June 5), the sequence is:

  1. 18:43:18 — configure-toolset.sh runs dotnetup sdk install → creates src/sdk/.dotnet/ with a full SDK (2623 binaries)
  2. 18:44:08 — init-detect-binaries.proj runs the binary scan, finds all 2623 binaries unmatched
  3. 19:06:41 — BinaryScanTest.ScanForBinaries reads the report and fails

configure-toolset.sh has a from_vmr == true guard that should skip the install in VMR builds, but it's not taking effect in the shortstack build context.

The existing exclusion .dotnet/ in allowed-sb-binaries.txt only matches the root-level .dotnet/ directory. The nested src/sdk/.dotnet/ is not covered.

Fix

Adding **/.dotnet/ matches .dotnet/ directories at any depth. Verified locally that Microsoft.Extensions.FileSystemGlobbing.Matcher correctly matches paths like src/sdk/.dotnet/sdk/.../file.dll with this pattern.

Open questions

  • Should the deeper fix be ensuring from_vmr is properly set when configure-toolset.sh runs in shortstack builds, so the dotnetup install is skipped entirely?
  • Or should the binary scan run before any SDK bootstrap steps?

cc @dotnet/source-build @dotnet/dotnet-cli

The BinaryScanTest.ScanForBinaries test has been failing on all main
official builds since June 5 because the SDK bootstrap installs to
src/sdk/.dotnet/ (via dotnetup) and the existing .dotnet/ exclusion
only matches the root-level directory.

The SDK global.json has runtimes defined, which causes tools.sh to
fall back to repo-local .dotnet instead of using the VMR root .dotnet/.
The switch from dotnet-install.sh to dotnetup introduced new binaries
(dotnet-watch satellite assemblies and hotreload shims) that were not
previously present.

This adds **/.dotnet/ to match .dotnet directories at any depth.
This may not be the correct long-term fix - the right solution may be
to ensure dotnetup installs to the root .dotnet/ or to handle the
nested bootstrap differently.

Co-authored-by: Copilot <[email protected]>
@lewing
lewing marked this pull request as ready for review June 6, 2026 22:17
@lewing
lewing requested review from a team as code owners June 6, 2026 22:17
Copilot AI review requested due to automatic review settings June 6, 2026 22:17

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 updates the source-build binary allowlist to account for nested SDK bootstrap directories (e.g., src/sdk/.dotnet/) so source-build binary scanning doesn’t flag bootstrap SDK/tooling binaries introduced by the newer dotnetup install layout.

Changes:

  • Add a recursive allowlist entry for .dotnet/ directories at any repo depth (**/.dotnet/) in the source-build allowlist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lewing
lewing marked this pull request as draft June 6, 2026 22:30
@lewing
lewing requested a review from nagilson June 6, 2026 23:07
@lewing
lewing marked this pull request as ready for review June 7, 2026 03:26

@ViktorHofer ViktorHofer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The inner repo .dotnet folders shouldn't exist at all. This is working around an infra regression.

@ViktorHofer ViktorHofer closed this Jun 8, 2026
@ViktorHofer
ViktorHofer deleted the fix-binary-scan-dotnet-dir branch June 8, 2026 08:36
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.

4 participants