microsoft / microsoft/winget-cli

Support the `-Debug` parameter in Microsoft.WinGet.Client PowerShell module

Open
#4,697 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

          The current version of `Assert-WinGetPackageManager` (1.8.1911) actually throws when I try to use the `-Debug` parameter:
PS C:\Windows\system32> Assert-WinGetPackageManager -Debug
Assert-WinGetPackageManager : Debug parameter not supported
At line:1 char:1
+ Assert-WinGetPackageManager -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Assert-WinGetPackageManager], NotSupportedException
    + FullyQualifiedErrorId : System.NotSupportedException,Microsoft.WinGet.Client.Commands.AssertWinGetPackageManagerCmdlet

That's unfortunate cmdlet design because it's unexpected / unprecedented in PowerShell. Even PlatyPS as we can see just assumes the common parameters are at least available even if not utilized, but a cmdlet really shouldn't throw an exception when attempting to use them. The way it is now, -Debug would have to be removed from this list of supported parameters because it's clearly not supported, but really the cmdlet should be updated to just not throw that exception.

Originally posted by @jantari in https://github.com/microsoft/winget-cli/pull/4674#discussion_r1700480175

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 with the Microsoft.WinGet.Client implementation of the Assert-WinGetPackageManager cmdlet and reproduce the shown PowerShell invocation with -Debug. Done means the cmdlet accepts -Debug without throwing the reported NotSupportedException.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.