Skip to content

Commit 6593b42

Browse files
authored
Implement support for switching targetArchitecture on Windows ARM64 (#5646)
**Changes:** * Enable use of `targetArchitecture` property on Windows * Update `targetArchitecture` to be an enum with properties `arm64` and `x86_64` * Download both ARM64 and X86_64 `vsdbg-ui` when on Windows ARM64 * Update tests Addresses #5004 Tested manually both on Windows X64 and ARM64. Can provide an ARM64 Windows VM for validation if needed.
1 parent c6718e7 commit 6593b42

File tree

4 files changed

+72
-17
lines changed

4 files changed

+72
-17
lines changed

package.json

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -402,28 +402,29 @@
402402
"id": "Debugger",
403403
"description": ".NET Core Debugger (Windows / x64)",
404404
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-25-7/coreclr-debug-win7-x64.zip",
405-
"installPath": ".debugger",
405+
"installPath": ".debugger/x86_64",
406406
"platforms": [
407407
"win32"
408408
],
409409
"architectures": [
410-
"x86_64"
410+
"x86_64",
411+
"arm64"
411412
],
412-
"installTestPath": "./.debugger/vsdbg-ui.exe",
413+
"installTestPath": "./.debugger/x86_64/vsdbg-ui.exe",
413414
"integrity": "10F4DA0626D3BA8599FA27A6C1AE6293037158350A30B55501664DA56E4D7FC9"
414415
},
415416
{
416417
"id": "Debugger",
417418
"description": ".NET Core Debugger (Windows / ARM64)",
418419
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-25-7/coreclr-debug-win10-arm64.zip",
419-
"installPath": ".debugger",
420+
"installPath": ".debugger/arm64",
420421
"platforms": [
421422
"win32"
422423
],
423424
"architectures": [
424425
"arm64"
425426
],
426-
"installTestPath": "./.debugger/vsdbg-ui.exe",
427+
"installTestPath": "./.debugger/arm64/vsdbg-ui.exe",
427428
"integrity": "85426D6D98DBCFA1220F5A74D51D8FDB530903F612BF95A406E95D18F67E4821"
428429
},
429430
{
@@ -888,7 +889,11 @@
888889
},
889890
"targetArchitecture": {
890891
"type": "string",
891-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
892+
"enum": [
893+
"x86_64",
894+
"arm64"
895+
],
896+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
892897
},
893898
"type": {
894899
"type": "string",
@@ -1981,7 +1986,11 @@
19811986
},
19821987
"targetArchitecture": {
19831988
"type": "string",
1984-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
1989+
"enum": [
1990+
"x86_64",
1991+
"arm64"
1992+
],
1993+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
19851994
},
19861995
"checkForDevCert": {
19871996
"type": "boolean",
@@ -2417,7 +2426,11 @@
24172426
},
24182427
"targetArchitecture": {
24192428
"type": "string",
2420-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
2429+
"enum": [
2430+
"x86_64",
2431+
"arm64"
2432+
],
2433+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
24212434
}
24222435
}
24232436
}
@@ -3113,7 +3126,11 @@
31133126
},
31143127
"targetArchitecture": {
31153128
"type": "string",
3116-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
3129+
"enum": [
3130+
"x86_64",
3131+
"arm64"
3132+
],
3133+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
31173134
},
31183135
"checkForDevCert": {
31193136
"type": "boolean",
@@ -3549,7 +3566,11 @@
35493566
},
35503567
"targetArchitecture": {
35513568
"type": "string",
3552-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
3569+
"enum": [
3570+
"x86_64",
3571+
"arm64"
3572+
],
3573+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
35533574
}
35543575
}
35553576
}

src/coreclr-debug/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ export class CoreClrDebugUtil {
9999
}
100100
}
101101

102-
const MINIMUM_SUPPORTED_OSX_ARM64_DOTNET_CLI: string = '6.0.0';
102+
const MINIMUM_SUPPORTED_ARM64_DOTNET_CLI: string = '6.0.0';
103103

104104
export function getTargetArchitecture(platformInfo: PlatformInformation, launchJsonTargetArchitecture: string | undefined, dotnetInfo: DotnetInfo): string {
105-
if (!platformInfo.isMacOS())
105+
if (!platformInfo.isMacOS() && !platformInfo.isWindows())
106106
{
107107
// Nothing to do here.
108108
return '';
109109
}
110110

111-
// On Apple M1 Machines, we need to determine if we need to use the 'x86_64' or 'arm64' debugger.
111+
// On Windows ARM64 and Apple M1 Machines, we need to determine if we need to use the 'x86_64' or 'arm64' debugger.
112112

113113
// 'targetArchitecture' is specified in launch.json configuration, use that.
114114
if (launchJsonTargetArchitecture)
@@ -121,7 +121,7 @@ export function getTargetArchitecture(platformInfo: PlatformInformation, launchJ
121121
}
122122

123123
// If we are lower than .NET 6, use 'x86_64' since 'arm64' was not supported until .NET 6.
124-
if (semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_OSX_ARM64_DOTNET_CLI))
124+
if (semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_ARM64_DOTNET_CLI))
125125
{
126126
return 'x86_64';
127127
}

src/tools/OptionsSchema.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,11 @@
406406
},
407407
"targetArchitecture": {
408408
"type": "string",
409-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
409+
"enum": [
410+
"x86_64",
411+
"arm64"
412+
],
413+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
410414
},
411415
"checkForDevCert": {
412416
"type": "boolean",
@@ -499,7 +503,11 @@
499503
},
500504
"targetArchitecture": {
501505
"type": "string",
502-
"description": "[Only supported in local macOS debugging] The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64."
506+
"enum": [
507+
"x86_64",
508+
"arm64"
509+
],
510+
"description": "The architecture of the debuggee. This will automatically be detected unless this parameter is set. Allowed values are x86_64 or arm64. This value is ignored on Linux."
503511
}
504512
}
505513
},

test/unitTests/coreclr-debug/targetArchitecture.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,33 @@ suite("getTargetArchitecture Tests", () => {
2323

2424
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
2525

26-
assert.equal(targetArchitecture, "");
26+
assert.equal(targetArchitecture, "x86_64");
27+
});
28+
29+
test("Windows: X64 SDK on ARM64", () => {
30+
const platformInfo = new PlatformInformation("win32", "arm64");
31+
const dotnetInfo: DotnetInfo = {
32+
FullInfo: "Irrelevant",
33+
Version: "6.0.0",
34+
RuntimeId: "win10-x64",
35+
};
36+
37+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
38+
39+
assert.equal(targetArchitecture, "x86_64");
40+
});
41+
42+
test("Windows: ARM64 SDK on ARM64", () => {
43+
const platformInfo = new PlatformInformation("win32", "arm64");
44+
const dotnetInfo: DotnetInfo = {
45+
FullInfo: "Irrelevant",
46+
Version: "6.0.0",
47+
RuntimeId: "win10-arm64",
48+
};
49+
50+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
51+
52+
assert.equal(targetArchitecture, "arm64");
2753
});
2854
});
2955

0 commit comments

Comments
 (0)