Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable running in ARM64-native mode on .NET Framework. #74285

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

teo-tsirpanis
Copy link
Contributor

Fixes dotnet/runtime#104548.

This PR updates app.manifest to add the newly introduced supportedArchitectures element. This enables Roslyn to run in native ARM64 architecture when running on .NET Framework (for example in builds inside Visual Studio), and on Windows 11 24H2+.

@teo-tsirpanis teo-tsirpanis requested a review from a team as a code owner July 8, 2024 15:40
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 8, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Jul 8, 2024
@ViktorHofer
Copy link
Member

cc @jaredpar as we talked about this on Teams

@jaredpar
Copy link
Member

jaredpar commented Jul 8, 2024

on Windows 11 24H2+.

Do we have any data on what happens when this is run on a lower version of Windows?

Copy link
Member

@jaredpar jaredpar left a comment

Choose a reason for hiding this comment

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

Need to resolve:

  • What happens on x86 architectures?
  • What happens on older OS when this entry is added to the manifest.

@teo-tsirpanis
Copy link
Contributor Author

  • What happens on x86 architectures?

    • Windows 11 does not support x86, if that's what you mean.
  • What happens on older OS when this entry is added to the manifest.

    • Just compiled a simple C++ program with a custom manifest that has this entry and it runs fine on Windows 11 23H2.

@jaredpar
Copy link
Member

jaredpar commented Jul 8, 2024

Windows 11 does not support x86, if that's what you mean.

The compiler runs on many different OS. Pretty much any OS still in support.

@akoeplinger
Copy link
Member

@jaredpar I tested on Windows 10 and the entry is ignored there.

@jaredpar
Copy link
Member

jaredpar commented Jul 19, 2024

@jasonmalinowski PTAL. This would be injected into pretty much any .NET Framework EXE in our repo which includes msbuild host and guessing other IDE items. This is safe as long as the EXE are ARM64 compatible (not relying on emulation to AMD64 to execute). That should be the case unless it is doing any PInvoke or arch specific interop code. I can vouch for the compiler exes but need IDE to take a look for theirs.

@jaredpar
Copy link
Member

@dotnet/roslyn-compiler PTAL

@jaredpar jaredpar added this to the 17.12 milestone Jul 19, 2024
@jasonmalinowski
Copy link
Member

@jaredpar I can't think of an obvious problem here. Going through various processes we ship:

  1. ServiceHub (our OOP process): you changing the manifest won't impact that, but we already run this on arm64.
  2. LSP language server: we already run on arm64.
  3. MSBuildWorkspace's build host process: one or two P/Invokes for the Linux/Mac case only. And we already are running that on macOS arm64 so architectural screwups (like some code assuming certain endianness) won't be a problem.
  4. LSIF indexer: all managed code, and not currently being ran anywhere on arm64 no matter what.

If the following scenario is also legal I could imagine this might break:

  1. Windows arm64 device.
  2. .NET runtime (NOT SDK) installed for arm64 and x64.
  3. .NET SDK installed only for x64
  4. VS Code installed with an x64 flavor, which was running under emulation.
  5. The x64 C# extension.

If the build host and LSP server were running under x64 runtimes, then this might all work. But if the build host then now runs as native arm64, the lack of SDK for that platform might break it. The user of course should just install the arm64 SDK too. 😄

@jasonmalinowski
Copy link
Member

Tagging @dibarbet if he has any other ideas.

@jasonmalinowski
Copy link
Member

@jaredpar pointed out I was forgetting this change only applies to .NET Framework, so my concern about say VS Code doesn't matter since that's all .NET Core and doesn't care. So we're probably fine.

@jaredpar jaredpar merged commit 4996324 into dotnet:main Jul 19, 2024
25 of 28 checks passed
@dotnet-policy-service dotnet-policy-service bot modified the milestones: 17.12, Next Jul 19, 2024
@teo-tsirpanis teo-tsirpanis deleted the patch-1 branch July 19, 2024 20:29
@huoyaoyuan
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Area-Infrastructure Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows ARM] Building libraries from Visual Studio results in an x64 compiler being used
8 participants