Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pwsh Module Install-WinGetPackage terminating error #2091

Open
bftblomster opened this issue Apr 13, 2022 · 1 comment
Open

pwsh Module Install-WinGetPackage terminating error #2091

bftblomster opened this issue Apr 13, 2022 · 1 comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@bftblomster
Copy link
Contributor

bftblomster commented Apr 13, 2022

So I started playing around with the Powershell module in
https://github.com/microsoft/winget-cli/tree/master/tools/PowerShell/Microsoft.WinGet.Client/src

First thing is that it is limited to specific functions. I'm not sure if this is intentional or not but I changed this line in https://github.com/microsoft/winget-cli/blob/master/tools/PowerShell/Microsoft.WinGet.Client/src/Microsoft.WinGet.Client.psd1#L70
from:
FunctionsToExport = @("Get-WinGetPackage", "Get-WinGetSource", "Get-WinGetVersion", "Add-WinGetSource")
To:
FunctionsToExport = '*'

This let me use the other functions.

Steps to reproduce

Run any Install-WinGetPackage command

Expected behavior

Continue to install package

Actual behavior

Terminating error
Install-WinGetPackage -Id Zoom.Zoom -Exact
You will get a bunch of null-value errors:

At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:91 char:13
+             $WinGetArgs += "--Name", $Name.Replace("…", "")
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:95 char:13
+             $WinGetArgs += "--Moniker", $Moniker.Replace("…", "")
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:99 char:13
+             $WinGetArgs += "--Tag", $Tag.Replace("…", "")
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:103 char:13
+             $WinGetArgs += "--Command", $Command.Replace("…", "")
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:111 char:13
+             $WinGetArgs += "--Source", $Source.Replace("…", "")
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Invoke-WinGetCommand : Cannot bind argument to parameter 'WinGetArgs' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.WinGet.Client\0.1.0\Library\Find-WinGetPackage.ps1:132 char:50
+         $List = Invoke-WinGetCommand -WinGetArgs $WinGetArgs -IndexTi ...
+                                                  ~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-WinGetCommand], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Invoke-WinGetCommand

Unable to locate package for installation

Environment

Windows Package Manager v1.2.10271
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19044.1586
Package: Microsoft.DesktopAppInstaller v1.17.10271.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
@msftbot msftbot bot added the Needs-Triage label Apr 13, 2022
@denelon denelon added Issue-Feature This is a feature request for the Windows Package Manager client. and removed Needs-Triage labels Apr 13, 2022
@bftblomster
Copy link
Contributor Author

bftblomster commented Apr 13, 2022

Check PR #2092 for possible solution

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Issue-Feature This is a feature request for the Windows Package Manager client. labels Apr 13, 2022
@bftblomster bftblomster changed the title Powershell Module Issues pwsh Module Install-WinGetPackage terminating error Apr 14, 2022
@denelon denelon added this to the v1.3-Client milestone Apr 14, 2022
@denelon denelon modified the milestones: v1.3-Client, v1.4-Client May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

2 participants