Skip to content

msbuild: names MSBuild seeds from the profile read inexact unseeded (#1130) - #1138

Merged
Smaug123 merged 2 commits into
mainfrom
issue-1130-local-app-data
Nov 25, 2026
Merged

Smaug123 merged 2 commits into
mainfrom
issue-1130-local-app-data

Conversation

@Smaug123

Copy link
Copy Markdown
Collaborator

Claim

When the caller's environment lacks one of the names that MSBuild's evaluator defines from the process profile before any project text runs, every read of that name is exact against MSBuild or declined. MSBuild 18.9's Utilities.GetEnvironmentProperties seeds five such names: MSBuildExtensionsPath, MSBuildExtensionsPath32, MSBuildExtensionsPath64, LocalAppData and MSBuildUserExtensionsPath. "Every read" covers a direct read, an emptiness gate either way, a write gated on the name being set, and the SDK's self-default idiom (<X Condition="'$(X)' == ''">fallback</X>).

Domain

  • The five names above, in any spelling, absent from the walk's environment.
  • A name the caller does supply is the caller's value, which the walk reads exactly as before.
  • Names MSBuild seeds from somewhere other than the profile are out of scope.

Change

  • is_toolset_initial_property_name adds localappdata. An undefined read of it is now inexact. It is the one profile-seeded name that the msbuild prefix does not already cover.
  • TOOLSET_PREDEFINED_NAMES adds localappdata, msbuildextensionspath64 and msbuilduserextensionspath. The self-default exemption no longer treats their absence as a fact. Every profile-seeded name is now either on this list or seeded by the walk.

Tests

toolset_predefined_names_diff::profile_seeded_names_are_exact_or_declined reads each of the five names in three spellings and four shapes, against design-time MSBuild:

  • The test removes the five names from the walk's environment.
  • It grades PropertyRead. A Value must equal MSBuild's. Unset is an exact claim, so it fails wherever MSBuild holds a value. Only UnsetInexact and Untrusted count as declines.

predefined_names_without_an_sdk_are_exact_or_declined adds the three names to its overridable list.

Mutation checks:

  • Without the change, the test fails with 15 commits.
  • Reverting each list entry on its own also fails it.
  • Without the msbuilduserextensionspath entry, all three spellings of the self-default commit /FALLBACK.

Decline cost

None measured. Each of these is unchanged:

  • the msbuild corpus differential's manifest (fsproj_msbuild_corpus_diff);
  • the SDK chain decline attribution;
  • the restore-cone census and its reads manifests (restore_cone_reads_*.txt);
  • every other manifest in the whole-project gate.

The real-SDK must-commit lists in fsproj_global_perturbation_diff and fsproj_sdk_import_graph_generative_diff still pass.

Review and gate

Codex ran two rounds against origin/main 193c28caa.

  • Round 1 had two findings:

    • R3: the test handed the walk an environment that already seeded MSBuildUserExtensionsPath, so that name was never unseeded.
    • R2: unseeded, its self-default committed a fallback.

    Both are fixed in f351945f9, which adds a test that fails without the fix.

  • Round 2 had no findings.

The full gate ran locally on f351945f9, because the build box is unreachable: fmt, clippy, doc, the msbuild corpus and SDK chain sweeps, and every step of tools/ci/project-corpus-gate.sh, including the restore-cone census. All are green. The machine's load average was 40–80 throughout, because other worktrees were building.

Closes #1130

🤖 Generated with Claude Code

Smaug123 and others added 2 commits November 25, 2026 08:35
…1130)

MSBuild's evaluator defines `LocalAppData` from the process's profile
when the environment lacks it (`Utilities.GetEnvironmentProperties`, 18.9),
as it does the extension paths. The walk read an unseeded `LocalAppData`
as exactly unset, and committed what rested on that: `$(LocalAppData)`
as empty, a gate on it as false, a write gated on it as absent. It also
believed the SDK's self-default idiom for `MSBuildExtensionsPath64`, which
MSBuild likewise defines before any project text runs.

- `is_toolset_initial_property_name` now includes `localappdata`, so an
  undefined read of it is inexact. This is the one name of the
  profile-seeded set that the `msbuild` prefix does not cover.
- `TOOLSET_PREDEFINED_NAMES` now includes `localappdata` and
  `msbuildextensionspath64`, so the self-default exemption no longer
  treats their absence as a fact.

Test first: `profile_seeded_names_are_exact_or_declined` reads each of
the five names `GetEnvironmentProperties` seeds, in three spellings, in
four shapes: direct, an emptiness gate either way, a write gated on the
name being set (the `TasksAssembly` shape), and the self-default. Each
read must be exact against design-time MSBuild, or declined. It failed
with 15 commits before the fix, and each half of the fix, reverted, fails
it.

Decline cost: the msbuild corpus differential and the SDK chain
attribution do not move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…absence graded

Round 1 of review: `profile_seeded_names_are_exact_or_declined` handed the
walk `oracle_environment()`. That mirrors MSBuild's
`MSBuildUserExtensionsPath` into the walk's environment, so the name was
never unseeded. Unseeded, the self-default idiom committed its fallback.

- `TOOLSET_PREDEFINED_NAMES` now includes `msbuilduserextensionspath`, so
  every name `GetEnvironmentProperties` seeds is either listed or seeded.
- The test drops the names under test from the walk's environment. It
  grades `PropertyRead`: a value must equal MSBuild's; `Unset` is an exact
  claim and fails where MSBuild holds a value; only `UnsetInexact` and
  `Untrusted` count as declines.

Without the list entry, all three spellings of the self-default commit
`/FALLBACK`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

msbuild: LocalAppData absent from the environment is read as exactly unset; MSBuild supplies it from the profile

1 participant