-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix how processor arch is validated in Import-Module
#24265
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
Conversation
src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Outdated
Show resolved
Hide resolved
|
Can you please explain the purpose of this parameter in the manifest?
|
|
@iSazonov those are good questions, but outside the scope of this fix. This PR is simply fixing a regression that prevents existing modules from importing because the declared required processor architecture doesn't match what PowerShell thinks it's currently running as the existing code always returns MSIL from the .NET deprecated API. |


PR Summary
In .NET 9, the deprecated call to
AssemblyName.ProcessorArchitecturereturnsMSILso this causes the module manifestProcessorArchitecturekeyword to fail (unless it specifiesMSIL. Change is to use the current process architecture, however, this is a different enum, so we have to do direct comparisons. The module manifest limits whatProcessorArchitecturevalues are allowed, so we only need to check those.This is a regression from 7.4
PR Context
Fix #24225
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed:
(which runs in a different PS Host).