Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 15, 2025

The GetArchitectureForSource methods in AssemblyMetadataProvider and AssemblyLoadWorker were missing support for ARM64 native assemblies. When VsTest encountered ARM64 binaries, it would fail to detect the correct architecture and fall back to either the user-specified default or the machine's architecture, resulting in incorrect testhost selection.

This change adds the missing ARM64 constant and switch case to both methods:

Changes made:

  1. Added IMAGE_FILE_MACHINE_ARM64 = 0xAA64 constant (matching MSBuild's definition)
  2. Added ARM64 case to the machine type switch statements to return Architecture.ARM64

Before:

switch (machine)
{
    case imageFileMachineI386:
        archType = Architecture.X86;
        break;
    case imageFileMachineAmd64:
    case imageFileMachineIa64:
        archType = Architecture.X64;
        break;
    case imageFileMachineArm:
    case imageFileMachineThumb:
    case imageFileMachineArmnt:
        archType = Architecture.ARM;
        break;
    // ARM64 missing - would fall through to default
}

After:

switch (machine)
{
    case imageFileMachineI386:
        archType = Architecture.X86;
        break;
    case imageFileMachineAmd64:
    case imageFileMachineIa64:
        archType = Architecture.X64;
        break;
    case imageFileMachineArm:
    case imageFileMachineThumb:
    case imageFileMachineArmnt:
        archType = Architecture.ARM;
        break;
    case imageFileMachineArm64:
        archType = Architecture.ARM64;
        break;
}

This ensures VsTest can now correctly identify ARM64 native assemblies and select the appropriate ARM64 testhost, improving test execution on ARM64 platforms.

Fixes #15275.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 37cvsblobprodcus359.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • 4m6vsblobprodcus384.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • 5dkvsblobprodcus355.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • c50vsblobprodcus330.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • fdpvsblobprodcus345.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • pkvvsblobprodcus321.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)
  • yttvsblobprodcus357.vsblob.vsassets.io
    • Triggering command: dotnet build src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits September 15, 2025 12:43
Co-authored-by: nohwnd <5735905+nohwnd@users.noreply.github.com>
Co-authored-by: nohwnd <5735905+nohwnd@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] VsTest does not correctly pick the testhost for ARM64 native assemblies Add ARM64 support to GetArchitectureForSource methods Sep 15, 2025
@Copilot Copilot AI requested a review from nohwnd September 15, 2025 12:49
Copilot finished work on behalf of nohwnd September 15, 2025 12:49
@nohwnd
Copy link
Member

nohwnd commented Sep 19, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@nohwnd nohwnd marked this pull request as ready for review September 26, 2025 14:02
@nohwnd nohwnd merged commit 4066374 into main Sep 29, 2025
7 checks passed
@nohwnd nohwnd deleted the copilot/fix-15275 branch September 29, 2025 07:20
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.

VsTest does not correctly pick the testhost for ARM64 native assemblies
4 participants