basicx-StrgV / WGet.NET

A WinGet wrapper library for .Net. Easily install, update, uninstall and more, from your application.

Home Page:https://basicx-strgv.github.io/WGet.NET/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetInstalledPackages throws exception if no packages.

MrHinsh opened this issue · comments

Why does packageManager.GetInstalledPackages(PackageId) throw an exception when no packages are returned rather than null?

 WGetNET.WinGetActionFailedException: The search of installed packages failed.
 ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at WGetNET.HelperClasses.ProcessOutputReader.ToPackageList(String[] output, PackageAction action, String sourceName)
   at WGetNET.WinGetPackageManager.GetInstalledPackages(String packageName)
   --- End of inner exception stack trace ---
   at WGetNET.WinGetPackageManager.GetInstalledPackages(String packageName)
   at MigrationTools.Host.Services.DetectVersionService2.InitialiseService() in C:\Users\MartinHinshelwood(He\Source\repos\azure-devops-migration-tools\src\MigrationTools.Host\Services\DetectVersionService2.cs:line 70

Is there another way to check this?

commented

This seems to be a bug. Normally it should return an empty list.

commented

I fixed the problem.
I will inform you and close the issue when the version with the fix is released.

commented

Version 3.1.0 is out now with a fix for this issue.

https://github.com/basicx-StrgV/WGet.NET/releases/tag/3.1.0