Running tests for PR #1912 - #2027
Open
alerickson wants to merge 11 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecfe8a78-5952-4edd-a25a-a840b33f7e71
alerickson
requested review from
Sydney Smith (SydneyhSmith),
Aditya Patwardhan (adityapatwardhan),
Anam Navied (anamnavi) and
shammu1
as code owners
September 9, 2026 21:37
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🔵 Needs a closer look
There is a confirmed null-dereference in GetPathsFromEnvVarAndScope when scope is null, which can cause runtime failure.
Pull request overview
This PR updates PSResourceGet’s user-scope install/search path resolution to prefer PowerShell’s $PSUserContentPath (with legacy fallbacks) and adds end-to-end coverage to validate the resolved install locations.
Changes:
- Update
Utils.GetStandardPlatformPathsto resolve the current-user base path via$PSUserContentPath, falling back to legacy paths when unavailable. - Add internal test hooks to capture the last-resolved user content path and its source.
- Add Pester end-to-end tests validating CurrentUser vs AllUsers installation locations and the
$PSUserContentPath/legacy selection behavior.
File summaries
| File | Description |
|---|---|
test/PSContentPath.Tests.ps1 |
Adds end-to-end Pester coverage around user content path selection and install locations. |
src/code/Utils.cs |
Switches current-user base directory resolution to $PSUserContentPath with legacy fallback and verbose tracing. |
src/code/InternalHooks.cs |
Adds hook fields + helper methods for testing the resolved content path/source. |
Review details
Suppressed comments (1)
src/code/Utils.cs:1116
GetPathsFromEnvVarAndScopeclaims to supportscopebeing null (see thescope is nullcheck), but it still dereferencesscope.Valuewhen adding AllUsers paths. Ifscopeis actually null, this will throw aNullReferenceExceptionand also prevents returning the AllUsers paths when scope is omitted.
List<string> resourcePaths = new List<string>();
if (scope is null || scope.Value is ScopeType.CurrentUser)
{
resourcePaths.Add(Path.Combine(psUserContentPath, "Modules"));
resourcePaths.Add(Path.Combine(psUserContentPath, "Scripts"));
}
if (scope.Value is ScopeType.AllUsers)
{
resourcePaths.Add(Path.Combine(programFilesPath, "Modules"));
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
14 tasks
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
PR Context
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.