winget-cli
winget-cli copied to clipboard
Support the `-Debug` parameter in Microsoft.WinGet.Client PowerShell module
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