PowerShell / PowerShell/PSScriptAnalyzer
Function 'GetCommandInfo' does not add CommandInfo to cache
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
In Helper.cs, the function GetCommandInfo checks the commandInfoCache for a given command, and - if it does not exist in the cache - retrieves the info from a powershell session. Unlike in the deprecated function GetCommandInfoLegacy, however the command info is never added to the commandInfoCache dictionary. (Compare lines 750 and 776)
I'd like to open a PR to correct this, assuming this is indeed a bug.
This should help marginally with performance issues due to contentions from the locks in the GetCommandInfo and GetCommandInfoLegacy functions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Helper.cs at GetCommandInfo and compare its cache path with GetCommandInfoLegacy, particularly the referenced lines around 750 and 776. Confirm that a retrieved command's CommandInfo is added to commandInfoCache; done means the cache is populated consistently with the legacy path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100