From 7857fdfbeb1f6d673ae3aa3519ed6ac18499b335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20R=C3=B8nnestad=20Birkeland?= <6450056+o-l-a-v@users.noreply.github.com> Date: Fri, 4 Jul 2025 10:52:56 +0200 Subject: [PATCH 1/2] First attempt --- src/code/PSResourceInfo.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/code/PSResourceInfo.cs b/src/code/PSResourceInfo.cs index 6ddfe6e57..9b1e1071d 100644 --- a/src/code/PSResourceInfo.cs +++ b/src/code/PSResourceInfo.cs @@ -726,7 +726,8 @@ public static bool TryConvertFromJson( { foreach ( JsonElement dependencyGroup in dependencyGroupsElement.EnumerateArray().Where( - x => !string.IsNullOrWhiteSpace(x.GetProperty("@id").GetString()) + x => x.TryGetProperty("id", out JsonElement idProperty) && + !string.IsNullOrWhiteSpace(idProperty.GetString()) ) ) { @@ -736,7 +737,8 @@ JsonElement dependencyGroup in dependencyGroupsElement.EnumerateArray().Where( { foreach ( JsonElement dependency in dependenciesElement.EnumerateArray().Where( - x => !string.IsNullOrWhiteSpace(x.GetProperty("@id").GetString()) + x => x.TryGetProperty("id", out JsonElement idProperty) && + !string.IsNullOrWhiteSpace(idProperty.GetString()) ) ) { From d3992021c445a8ffc34fa5dadb3f9e08a7817548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20R=C3=B8nnestad=20Birkeland?= <6450056+o-l-a-v@users.noreply.github.com> Date: Fri, 4 Jul 2025 11:02:34 +0200 Subject: [PATCH 2/2] Don't check for "id" in dependencyGroup --- src/code/PSResourceInfo.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/code/PSResourceInfo.cs b/src/code/PSResourceInfo.cs index 9b1e1071d..6a07eb451 100644 --- a/src/code/PSResourceInfo.cs +++ b/src/code/PSResourceInfo.cs @@ -724,12 +724,7 @@ public static bool TryConvertFromJson( if (dependencyGroupsElement.ValueKind == JsonValueKind.Array) { - foreach ( - JsonElement dependencyGroup in dependencyGroupsElement.EnumerateArray().Where( - x => x.TryGetProperty("id", out JsonElement idProperty) && - !string.IsNullOrWhiteSpace(idProperty.GetString()) - ) - ) + foreach (JsonElement dependencyGroup in dependencyGroupsElement.EnumerateArray()) { if (dependencyGroup.TryGetProperty("dependencies", out JsonElement dependenciesElement)) {