Repository navigation
Closed
Labels
Issue-BugIt either shouldn't be doing this or needs an investigation.PowerShellIssue related to WinGet PowerShell Module or cmdlet
Milestone
Description
Brief description of your issue
One thing I noticed in the prerelease v1.4.3531 is that the CatalogPackage objects have an AvailableVersions property that I can't seem to access in any way:
The property
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ Get-WinGetPackage -Source winget | gm
TypeName: Microsoft.Management.Deployment.CatalogPackage
Name MemberType Definition
---- ---------- ----------
CheckInstalledStatus Method Microsoft.Management.Deployment.CheckInstalledStatusResult CheckInstalledStatus(Microsoft.Management.Deployment.InstalledStatusType checkTypes), M…
CheckInstalledStatusAsync Method Windows.Foundation.IAsyncOperation[Microsoft.Management.Deployment.CheckInstalledStatusResult] CheckInstalledStatusAsync(Microsoft.Management.Depl…
Equals Method bool Equals(Microsoft.Management.Deployment.CatalogPackage other), bool Equals(System.Object obj), bool IEquatable[CatalogPackage].Equals(Microsof…
GetHashCode Method int GetHashCode()
GetInterface Method System.Runtime.InteropServices.CustomQueryInterfaceResult ICustomQueryInterface.GetInterface([ref] guid iid, [ref] System.IntPtr ppv)
GetInterfaceImplementation Method System.RuntimeTypeHandle IDynamicInterfaceCastable.GetInterfaceImplementation(System.RuntimeTypeHandle interfaceType)
GetObjectReferenceForType Method WinRT.IObjectReference IWinRTObject.GetObjectReferenceForType(System.RuntimeTypeHandle type)
GetObjectReferenceForTypeFallback Method WinRT.IObjectReference IWinRTObject.GetObjectReferenceForTypeFallback(System.RuntimeTypeHandle type)
GetOrCreateTypeHelperData Method System.Object IWinRTObject.GetOrCreateTypeHelperData(System.RuntimeTypeHandle type, System.Func[System.Object] helperDataFactory)
GetPackageVersionInfo Method Microsoft.Management.Deployment.PackageVersionInfo GetPackageVersionInfo(Microsoft.Management.Deployment.PackageVersionId versionKey)
GetType Method type GetType()
IsInterfaceImplemented Method bool IDynamicInterfaceCastable.IsInterfaceImplemented(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented)
IsInterfaceImplementedFallback Method bool IWinRTObject.IsInterfaceImplementedFallback(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented)
ToString Method string ToString()
AdditionalTypeData Property System.Collections.Concurrent.ConcurrentDictionary[System.RuntimeTypeHandle,System.Object] AdditionalTypeData {get;}
AvailableVersions Property System.Collections.Generic.IReadOnlyList[Microsoft.Management.Deployment.PackageVersionId] AvailableVersions {get;}
DefaultInstallVersion Property Microsoft.Management.Deployment.PackageVersionInfo DefaultInstallVersion {get;}
HasUnwrappableNativeObject Property bool HasUnwrappableNativeObject {get;}
Id Property string Id {get;}
InstalledVersion Property Microsoft.Management.Deployment.PackageVersionInfo InstalledVersion {get;}
IsUpdateAvailable Property bool IsUpdateAvailable {get;}
Name Property string Name {get;}
NativeObject Property WinRT.IObjectReference NativeObject {get;}
The error
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs = Get-WinGetPackage -Source winget | Where IsUpdateAvailable
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs.Count
32
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs[0].AvailableVersions
ExtendedTypeSystemException: The following exception occurred while trying to enumerate the collection: "No such interface supported
".
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ Get-Error
Exception :
Type : System.Management.Automation.ExtendedTypeSystemException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : The following exception occurred while trying to enumerate the collection: "No such interface supported
".
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : ExceptionInGetEnumerator
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : -1
Line : $pkgs[0].AvailableVersions
PositionMessage : At line:1 char:1
+ $pkgs[0].AvailableVersions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
TargetSite :
Name : GetGenericEnumerator
DeclaringType : System.Management.Automation.EnumerableOps, System.Management.Automation, Version=7.2.8.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : The following exception occurred while trying to enumerate the collection: "No such interface supported
".
Data : System.Collections.ListDictionaryInternal
InnerException :
Type : System.InvalidCastException
TargetSite :
Name : As
DeclaringType : WinRT.IObjectReference
MemberType : Method
Module : WinRT.Runtime.dll
Message : No such interface supported
HResult : -2147467262
StackTrace :
at WinRT.IObjectReference.As[T](Guid iid)
at WinRT.IObjectReference.As[T]()
at System.Collections.Generic.IReadOnlyListImpl`1.Make_IEnumerableObjRef()
at System.Collections.Generic.IReadOnlyListImpl`1.GetEnumerator()
at System.Management.Automation.EnumerableOps.GetGenericEnumerator[T](IEnumerable`1 enumerable)
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.EnumerableOps.GetGenericEnumerator[T](IEnumerable`1 enumerable)
at CallSite.Target(Closure , CallSite , Object , Pipe , ExecutionContext )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at System.Management.Automation.Interpreter.ActionCallInstruction`5.Invoke(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
at System.Management.Automation.Interpreter.CallInstruction.InvokeInstance(Object instance, Object[] args)
at System.Management.Automation.Interpreter.DynamicInstructionN.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
FullyQualifiedErrorId : ExceptionInGetEnumerator
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : -1
Line : $pkgs[0].AvailableVersions
PositionMessage : At line:1 char:1
+ $pkgs[0].AvailableVersions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Steps to reproduce
Install winget v1.4.3531 and then run this or equivalent:
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs = Get-WinGetPackage -Source winget | Where IsUpdateAvailable
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs.Count # make sure you have at least 1 object returned to repro
32
~\Downloads\Microsoft.WinGet.Client-PSModule
❯ $pkgs[0].AvailableVersions
Expected behavior
It should return the System.Collections.Generic.IReadOnlyList[Microsoft.Management.Deployment.PackageVersionId] value of the AvailableVersions property.
Actual behavior
It throws an exception.
Environment
Windows Package Manager v1.4.3531
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.25267.1000
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.3531.0
Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
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
---
> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.0-rc.1
PSEdition Core
GitCommitId 7.3.0-rc.1
OS Microsoft Windows 10.0.25267
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reacted by KD Puvvadi
Metadata
Metadata
Assignees
Labels
Issue-BugIt either shouldn't be doing this or needs an investigation.PowerShellIssue related to WinGet PowerShell Module or cmdlet
Activity
denelon commentedon Apr 22, 2023
denelon commentedon Apr 22, 2023
This will be in the next preview release.