From 5ffec26e2fee9fb2a99fc44683f3ecb6e8072891 Mon Sep 17 00:00:00 2001 From: donkey <84121166+iadonkey@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:57:40 +0100 Subject: [PATCH] fix: add packages to catalog that exist, but not in the requested version --- TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs index c2ea07c..edb597e 100644 --- a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs +++ b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs @@ -1257,6 +1257,7 @@ private async Task LoadInstalledPackagesAsync(CancellationToken cancellationToke if (_plcConfig != null) { + _installedPackages.RemoveAll(x => x.PackageId == null); foreach (var item in _plcConfig.Packages) { CatalogItem catalogItem = new CatalogItem(item); @@ -1277,7 +1278,8 @@ private async Task LoadInstalledPackagesAsync(CancellationToken cancellationToke catalogItem.Update = packageVersionLatest; } - if (!_installedPackages.Any(x => x.PackageId == catalogItem.PackageId)) + var packageId = catalogItem.PackageId ?? packageVersionLatest.PackageId; + if (packageId == null || !_installedPackages.Any(x => x.PackageId == packageId)) { _installedPackages.Add(catalogItem); }