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

Add Arm64 to list of architectures in Module Initialization. #4251

Merged

Conversation

snickler
Copy link
Contributor

@snickler snickler commented Mar 7, 2024


This PR addresses an issue that prevents the WinGet Cmdlets from loading in an Arm64 PowerShell 7.x environment.

Microsoft Reviewers: Open in CodeFlow

Add arm64 path and logic for dependencies into module.
Add Arm64 to list of ValidArchs
@snickler snickler requested a review from a team as a code owner March 7, 2024 19:38
@microsoft-github-policy-service microsoft-github-policy-service bot added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Mar 7, 2024
@yao-msft
Copy link
Contributor

yao-msft commented Mar 8, 2024

Currently the arm64 modules are not published. We'll need to validate the arm64 modules and make an internal pipeline change to publish them. Then we can take in this change. Thanks.

@snickler
Copy link
Contributor Author

snickler commented Mar 8, 2024

Currently the arm64 modules are not published. We'll need to validate the arm64 modules and make an internal pipeline change to publish them. Then we can take in this change. Thanks.

That answered the question I meant to ask earlier because I noticed it's only building x64 and x86 in the azure-pipelines and I figured that would be one of those changes that could potentially be a breaking one.

Thanks for the clarification!

@denelon
Copy link
Contributor

denelon commented Mar 8, 2024

@snickler thanks for the PR! We've been going through a lot of churn with our build pipelines and new internal requirements. Thanks so much for calling this out and doing something about it.

@msftrubengu
Copy link
Contributor

@snickler where you able to run the module locally?

@snickler
Copy link
Contributor Author

@snickler where you able to run the module locally?

I'm able to run the module locally to some extent. I'm trying to figure out what it's complaining about, but I believe it MAY have to do with the Any CPU projects. I'm now getting a Exception has been thrown by the target of an invocation error when running the commands specific to retrieving WinGet Source details and packages. Once I figure out what's happening here, I MAY have something usable. I think I'll make a separate PR for that effort.

@snickler
Copy link
Contributor Author

@snickler where you able to run the module locally?

I'm able to run the module locally to some extent. I'm trying to figure out what it's complaining about, but I believe it MAY have to do with the Any CPU projects. I'm now getting a Exception has been thrown by the target of an invocation error when running the commands specific to retrieving WinGet Source details and packages. Once I figure out what's happening here, I MAY have something usable. I think I'll make a separate PR for that effort.

OH WAIT @msftrubengu, I DID get it working. I made the mistake of testing with a Microsoft Store installed version of PowerShell.

image

I did find something I need to debug with it actually installing a package, because it blows up PowerShell:

image

@vedantmgoyal9
Copy link
Contributor

Regarding AnyCPU thing, I think ARM64 has to be specified separately, according to https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2022#target-platform. AnyCPU doesn't compile for ARM processors.

@msftrubengu
Copy link
Contributor

@snickler I was able to repro that AV using the non packaged version of PowerShell 7 for arm64. Yes, the package got installed and PowerShell crashed. Regardless, there's a known issue with running the module in the packaged version of PowerShell for all architectures that we want to address before calling it good for ARM64. Specially because winget's default installation of PowerShell in arm64 is the msix.

@msftrubengu
Copy link
Contributor

@snickler I created #4392 to enable arm64 for this module. Once that is merged, I'll merge this for the Initialize-LocalWinGetModules.ps1. Sorry it took this long.

@snickler
Copy link
Contributor Author

@snickler I created #4392 to enable arm64 for this module. Once that is merged, I'll merge this for the Initialize-LocalWinGetModules.ps1. Sorry it took this long.

It's no problem. Happy to see it!

msftrubengu added a commit that referenced this pull request Apr 20, 2024
This PR enables arm64 for the Microsoft.WinGet.Client module.

There's an OS bug that causes an AV (see
#4251 (comment))
in arm64 devices that was fixed in a newer Windows build. The AV message
is just shown for PowerShell Core. In Windows PowerShell no error
message is displayed but it won't display progress either. Regardless,
the winget install/uninstall operation still happens as the progress is
shown after we asked winget to install the app. The configuration module
doesn't get affected by the OS bug, so there's no need to disable
progress.

To keep showing progress the module now looks at the OS version. If the
processor architecture is arm64 and the OS version is lower than
10.0.26068.0 progress is disabled in the module.

I verified manually on arm64 builds with and without the fix. 

Fixes #4169

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/4392)
@msftrubengu
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@msftrubengu msftrubengu merged commit ab35bba into microsoft:master Apr 22, 2024
8 checks passed
msftrubengu added a commit to msftrubengu/winget-cli that referenced this pull request Apr 23, 2024
This PR enables arm64 for the Microsoft.WinGet.Client module.

There's an OS bug that causes an AV (see
microsoft#4251 (comment))
in arm64 devices that was fixed in a newer Windows build. The AV message
is just shown for PowerShell Core. In Windows PowerShell no error
message is displayed but it won't display progress either. Regardless,
the winget install/uninstall operation still happens as the progress is
shown after we asked winget to install the app. The configuration module
doesn't get affected by the OS bug, so there's no need to disable
progress.

To keep showing progress the module now looks at the OS version. If the
processor architecture is arm64 and the OS version is lower than
10.0.26068.0 progress is disabled in the module.

I verified manually on arm64 builds with and without the fix. 

Fixes microsoft#4169

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/4392)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Microsoft.WinGet.Client PowerShell Module failing to load on Arm64 in PowerShell 7.x
5 participants