-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Retrieve PowerShell version in PSVersionInfo using assembly informational version instead of FileVersionInfo #14332
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
|
@Fs00 Thanks for your contribution! |
|
@iSazonov Good to know. |
I see with the PR PowerShell loads less assembles at startup - it is great perf improvement! I think we will merge the PR. |
|
I see PowerShell/src/System.Management.Automation/security/SecuritySupport.cs Lines 1355 to 1357 in ea3036d
@PaulHigin @TravisEz13 Do we really need the Also GetMainModule() is very expensive. Could we use |
|
@Fs00 Thanks for your contribution! |
|
🎉 Handy links: |
|
@Fs00 Late to the party but please accept my gratitude for your efforts to bring PowerShell closer to single-file-application-friendly! |
PR Summary
This PR changes
PSVersionInfostatic constructor to retrieve PowerShell version data fromAssemblyInformationalVersionAttribute, instead of using FileVersionInfo class.PR Context
This change is a first step towards making System.Management.Automation single-file-application-friendly ‒ without this PR, PSVersionInfo static constructor throws an exception when used in a single-file application due to
Assembly.Locationreturning""‒ and provides a small performance boost at startup (which contributes a tiny bit to #14268) since it does not parse System.Management.Automation DLL to retrieve the version anymore.Here is the performance of the two changed lines:
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.