Skip to content

Fix 'FixupFileName' to not load resolved assembly during module discovery - #8634

Merged
Aditya Patwardhan (adityapatwardhan) merged 9 commits into
PowerShell:masterfrom
daxian-dbw:fixupfilename
Jan 16, 2019
Merged

Fix 'FixupFileName' to not load resolved assembly during module discovery#8634
Aditya Patwardhan (adityapatwardhan) merged 9 commits into
PowerShell:masterfrom
daxian-dbw:fixupfilename

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Jan 12, 2019

Copy link
Copy Markdown
Member

PR Summary

Changes are as follows:

  • Fix FixupFileName to not load an assembly in module analysis if the assembly path has been resolved. This way, the module analysis via Get-Module -ListAvailable wouldn't load the module assemblies unexpectedly.
  • Update the RequiredAssemblies processing to not add the same assembly to the ToProcess list twice, so that we can avoid loading the same assembly twice.
  • Remove unneeded #if !CoreCLR section about CLR version and .NET framework version.

PR Context

PR Checklist

@daxian-dbw

Copy link
Copy Markdown
Member Author

Steve Lee (@SteveL-MSFT) The -UseFuzzyMatch test failed again because ping.exe cannot be found. It failed in the daily build too. Can you please take a look?

Comment thread src/System.Management.Automation/engine/CommandDiscovery.cs Outdated
Comment thread test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 Outdated
Comment thread src/System.Management.Automation/engine/CommandDiscovery.cs Outdated
Comment thread src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also can you add the [Feature] flag to run all tests?

Comment thread test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 Outdated
@daxian-dbw

Copy link
Copy Markdown
Member Author

Aditya Patwardhan (@adityapatwardhan) Good point. I will add the feature tag.

@iSazonov

Copy link
Copy Markdown
Collaborator

I expect that the PR increase performance but we haven't CL-Performance label.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Jan 15, 2019

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) Changes in this PR could improve the module analysis perf for binary modules in general, because we now avoid the loading. But for the warm startup where the analysis cache has already been created, there's likely no difference.

The change to RequiredAssemblies avoid a redundant call to ExecutionContext.LoadAssembly. It should improve the perf in general, but again won't be much because it was loading an already loaded assembly.

This PR is mainly to fix the wrong behavior and also make FixupFileName easier to understand, and thus I think it's more of a CL-general.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jan 15, 2019
Comment thread src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Comment thread src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Comment thread test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 Outdated
@iSazonov

Copy link
Copy Markdown
Collaborator

Dongbo Wang (@daxian-dbw) Great! 👍

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants