From ce6140bf233024b17e414c85f2e0d6747c927261 Mon Sep 17 00:00:00 2001 From: Christoph Blank Date: Fri, 19 Jun 2026 12:47:38 +0200 Subject: [PATCH 1/4] Refactor GetModifiedSettingsContent to explicitly list properties for PS5 compatibility --- Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 index 3482ce5d0c..0b7f3a3b78 100644 --- a/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 +++ b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 @@ -727,7 +727,10 @@ function GetModifiedSettingsContent { $dstSettings | Add-Member -MemberType NoteProperty -Name "$schemaKey" -Value $schemaValue -Force # Make sure the $schema property is the first property in the object - $dstSettings = $dstSettings | Select-Object @{ Name = '$schema'; Expression = { $_.'$schema' } }, * -ExcludeProperty '$schema' + # PS5-safe: explicitly list properties instead of using wildcard to avoid literal '*' being added + $otherProperties = @($dstSettings.PSObject.Properties.Name | Where-Object { $_ -ne '$schema' }) + $selectProperties = @('$schema') + $otherProperties + $dstSettings = $dstSettings | Select-Object $selectProperties } } From 4e51a44b28ecaba52da2525667e5069509877ee9 Mon Sep 17 00:00:00 2001 From: Christoph Blank Date: Fri, 19 Jun 2026 12:52:12 +0200 Subject: [PATCH 2/4] add to releasenotes --- RELEASENOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f2705f1397..aae38568dd 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -51,6 +51,7 @@ The `DownloadProjectDependencies` action now downloads only artifacts from depen ### Issues - Issue 2277 Auto-exclude the `copilot` GitHub environment from CI/CD deployments. When the GitHub Copilot coding agent is enabled on a repository, GitHub auto-creates an environment named `copilot`. AL-Go now treats it the same way as `github-pages` and never attempts to deploy to it. +- Issue 2285 - CheckForUpdates now handles settings file `$schema` reordering in a PowerShell 5-safe way to avoid writing invalid entries like `"*": null` to settings JSON files. - Issue 2236 - `GetDependencies` `buildMode` prefix leaks across dependency iterations, causing incorrect artifact mask names when multiple `appDependencyProbingPaths` entries use different build modes - Incremental builds (`modifiedApps` mode) now correctly identify unmodified apps for projects whose `appFolders` reference paths outside the project directory (e.g. using `../`) - Issue 2204 - Workspace compilation ignores vsixFile setting From 9cff7324cc84ed000d4a9d88b10c4e5acf6bacd2 Mon Sep 17 00:00:00 2001 From: Christoph Blank Date: Fri, 19 Jun 2026 13:00:26 +0200 Subject: [PATCH 3/4] Add test for GetModifiedSettingsContent to handle PS5 wildcard behavior --- Tests/CheckForUpdates.Action.Test.ps1 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/CheckForUpdates.Action.Test.ps1 b/Tests/CheckForUpdates.Action.Test.ps1 index be6cfa9b98..9f73255520 100644 --- a/Tests/CheckForUpdates.Action.Test.ps1 +++ b/Tests/CheckForUpdates.Action.Test.ps1 @@ -268,6 +268,21 @@ Describe "CheckForUpdates Action: CheckForUpdates.HelperFunctions.ps1" { $modifiedContent."srcSetting" | Should -Be "value1" $modifiedContent."`$schema" | Should -Be "someSchema" } + + It 'GetModifiedSettingsContent does not create a literal * property when destination only contains $schema' { + # Repro for PS5 behavior where Select-Object with wildcard can emit "*": null + @{ "`$schema" = "sourceSchema"; "srcSetting" = "value1" } | ConvertTo-Json -Depth 10 | Out-File -FilePath $tmpSrcFile -Force + @{ "`$schema" = "destinationSchema" } | ConvertTo-Json -Depth 10 | Out-File -FilePath $tmpDstFile -Force + + $modifiedContentJson = GetModifiedSettingsContent -srcSettingsFile $tmpSrcFile -dstSettingsFile $tmpDstFile + $modifiedContent = $modifiedContentJson | ConvertFrom-Json + + $modifiedContent | Should -Not -BeNullOrEmpty + @($modifiedContent.PSObject.Properties.Name) | Should -Not -Contain '*' + $modifiedContentJson | Should -Not -Match '"\*"\s*:' + @($modifiedContent.PSObject.Properties.Name).Count | Should -Be 1 + $modifiedContent."`$schema" | Should -Be "sourceSchema" + } } Describe "CheckForUpdates Action: ApplyWorkflowDefaultInputs Tests" { From 7a5f3eb958671411d44bc6f3145bd310d9863542 Mon Sep 17 00:00:00 2001 From: Christoph Blank Date: Fri, 19 Jun 2026 13:05:01 +0200 Subject: [PATCH 4/4] Refactor GetModifiedSettingsContent to use variable for schema key, ensuring PS5 compatibility --- Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 index 0b7f3a3b78..29e6dbdb09 100644 --- a/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 +++ b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 @@ -728,9 +728,9 @@ function GetModifiedSettingsContent { # Make sure the $schema property is the first property in the object # PS5-safe: explicitly list properties instead of using wildcard to avoid literal '*' being added - $otherProperties = @($dstSettings.PSObject.Properties.Name | Where-Object { $_ -ne '$schema' }) - $selectProperties = @('$schema') + $otherProperties - $dstSettings = $dstSettings | Select-Object $selectProperties + $otherProperties = @($dstSettings.PSObject.Properties.Name | Where-Object { $_ -ne $schemaKey }) + $selectProperties = @($schemaKey) + $otherProperties + $dstSettings = $dstSettings | Select-Object -Property $selectProperties } }