Better resolution of file system modules in Get-Module – Chapter 2 - #27848
Draft
Guillermo López-Anglada (guillermooo) wants to merge 116 commits into
Draft
Conversation
The argument for `moduleNameOrPath` cannot be null at the current call sites.
The point is to return a fully qualified path, which cannot be the case if `relativeTo` is `null` and we need to use it.
The comment may not apply to newer versions of .NET.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Get-Module – Chapter 2
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
In which a new path resolution API is introduced that behaves like the old one but perhaps is simpler and better documented.
PR Context
The code base before this PR uses disparate APIs for path resolution, and there are comments suggesting that there is no common approach. I think this contributes to inconsistent behavior when performing module resolution in
Get-Module.First, two new methods have been added:
ResolveToFileSystemPathsThrowing()TryResolveToFileSystemPaths()These encapsulate all main existing path resolution behaviors.
Then, existing methods are implemented in terms of the new APIs above, and renamed to follow a more homogeneous pattern. Documentation has been improved in some places.
Important
These changes should be pure refactors and not alter existing behavior at all.
The new behavior can be verified with the available test suite (see Chapter 1), but it's unclear whether the test suite is comprehensive enough.
This is the full series of changes:
Get-Module– Chapter 1 #27847Get-Module– Chapter 2 #27848Get-Module– Chapter 3 #27853PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header