Skip to content

fix: Skip auto-updating .NET installs whose architecture doesn't match the current machine#2695

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-dotnet-install-tool-error
Draft

fix: Skip auto-updating .NET installs whose architecture doesn't match the current machine#2695
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-dotnet-install-tool-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

On an x64 machine with arm64 install records in extension state (e.g. from a prior arm64 VS Code session or settings migration), the auto-updater would download arm64 .NET and then fail to validate it — producing "the file is valid but intended for a different computer" (shown above).

Root cause

LocalInstallUpdateService.getInstallGroups() grouped all stored install records for update with no architecture guard. If state contained 9.0.16~arm64, the updater downloaded arm64 .NET and attempted to execute it for validation on the x64 process.

Changes

  • LocalInstallUpdateService.ts — In getInstallGroups(), resolve currentArchitecture once via DotnetCoreAcquisitionWorker.defaultArchitecture() and continue past any install record whose architecture differs. Emits SkippingIncompatibleArchitectureInstall for each skipped install.
// Skip installs for architectures that do not match the current machine.
if (architecture !== currentArchitecture)
{
    this.eventStream.post(new SkippingIncompatibleArchitectureInstall(
        `Skipping auto-update for ${install.dotnetInstall.installId}: install architecture '${architecture}' does not match the current machine architecture '${currentArchitecture}'.`));
    continue;
}
  • EventStreamEvents.ts — Added SkippingIncompatibleArchitectureInstall event class.

  • LocalInstallUpdateService.test.ts — Replaced hardcoded 'x64' in all createInstallRecord calls with DotnetCoreAcquisitionWorker.defaultArchitecture() (correctness on arm64 CI runners). Replaced the "separate architecture groups" test with "It skips installs with architectures incompatible with the current machine" which asserts only the compatible-arch group is acquired/uninstalled and the skip event is emitted.

Copilot AI and others added 2 commits May 28, 2026 18:17
Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
When the auto-update service runs, it now checks each stored install's
architecture against the current process architecture (os.arch()). Installs
whose architecture doesn't match the current machine are silently skipped
and a SkippingIncompatibleArchitectureInstall event is emitted.

This prevents the tool from downloading and then attempting to execute
arm64 .NET on an x64 Windows device (and vice-versa), which would fail
with "the file is valid but intended for a different computer".

Root cause: extension state containing arm64 install records (e.g. from
a prior arm64 VS Code session or migrated settings) caused the
LocalInstallUpdateService to try to acquire arm64 .NET from an x64 process,
resulting in a binary that cannot be run for validation on the x64 machine.

Fixes: #2244

Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix .NET Install Tool update issue for x64 device fix: Skip auto-updating .NET installs whose architecture doesn't match the current machine May 28, 2026
Copilot AI requested a review from nagilson May 28, 2026 18:34
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.

.NET Install Tool (v3.0.2) tries to update .NET arm64 on x64 device

2 participants