PowerShell / PowerShell/PSResourceGet

PSResourceGet exports the $PSGetPath variable but never sets the value

Open
#1,625 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Paths Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce

In a new session import PSResourceGet but don't import PowerShellGet v2. Examine the value of $PSGetPath.

Expected behavior
PS> Get-Variable PSGetPath -ValueOnly

AllUsersModules    : C:\Program Files\PowerShell\Modules
AllUsersScripts    : C:\Program Files\PowerShell\Scripts
CurrentUserModules : C:\Users\sewhee\Documents\PowerShell\Modules
CurrentUserScripts : C:\Users\sewhee\Documents\PowerShell\Scripts
Actual behavior
PS> Get-Variable PSGetPath -ValueOnly
Get-Variable: Cannot find a variable with the name 'PSGetPath'.
Error details

No error.

The variable $PSGetPath was added to PowerShellGet v2 in https://github.com/PowerShell/PowerShellGetv2/pull/486. The variable is never used by the modules, it is provided to give users information about the location of the Modules and Scripts folder for each scope.

PSResourceGet exports the variable in the module manifest, but nowhere in code does it set the value.

Environment data
PS> gmo -list Microsoft.PowerShell.PSResourceGet

    Directory: C:\Users\sewhee\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     1.0.2                 Microsoft.PowerShell.PSResourceGet  Core,Desk {Find-PSResource, Get-InstalledPSResour…
Binary     1.0.0                 Microsoft.PowerShell.PSResourceGet  Core,Desk {Find-PSResource, Get-InstalledPSResour…
Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by importing Microsoft.PowerShell.PSResourceGet without PowerShellGet v2 and reproducing the missing variable with Get-Variable PSGetPath. Inspect the module manifest export and the module initialization code, which the issue says never sets the value. Done means the variable is available after import and reports the four module and script paths shown in the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.