Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d2f34de
Fix command-line too long error when validating settings on PS5.1
Copilot Apr 30, 2026
49b0633
Skip settings validation on PS5.1 when JSON exceeds command-line leng…
Copilot Apr 30, 2026
e9b4c48
Add release note for PS5.1 settings validation fix
Copilot Apr 30, 2026
bb500e1
Address review: add warning on skip, use continue, add unit test
Copilot Apr 30, 2026
9bb017c
Remove warning when skipping schema validation on PS5.1
Copilot Apr 30, 2026
15e5296
Remove unnecessary Should -Not -Throw assertions from ValidateSetting…
Copilot Apr 30, 2026
89a6b4a
Add assertion that no warning is output when ValidateSettings skips o…
Copilot Apr 30, 2026
b320ab6
Fix test to mock OutputWarning instead of Write-Host
mazhelez May 1, 2026
5552365
Merge branch 'main' into copilot/fix-pwsh-exe-filename-warning
mazhelez May 4, 2026
5828c83
Resolve merge conflict in RELEASENOTES.md
Copilot May 6, 2026
1b5386d
Merge branch 'main' into copilot/fix-pwsh-exe-filename-warning
mazhelez May 20, 2026
d3d942c
Skip validation entirely on PS < 7 instead of only for oversized JSON
Copilot May 20, 2026
31d6b40
Move PS version check to hard exit at beginning of ValidateSettings f…
Copilot May 20, 2026
ce68b2d
Remove Invoke-Command wrapper since PS<7 now exits early
Copilot May 20, 2026
ac019f2
Merge branch 'main' into copilot/fix-pwsh-exe-filename-warning
mazhelez May 22, 2026
209cefe
Update test to reflect removal of Invoke-Command wrapper
Copilot May 22, 2026
0a61084
Merge remote-tracking branch 'origin/main' into copilot/fix-pwsh-exe-…
Copilot Jun 10, 2026
d9001ad
Merge branch 'main' into copilot/fix-pwsh-exe-filename-warning
aholstrup1 Jun 17, 2026
0bee92a
Merge branch 'main' into copilot/fix-pwsh-exe-filename-warning
mazhelez Jun 25, 2026
bee85ec
Fix PS5 test failure: only mock Test-Json on PS7+ where it exists
Copilot Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions Actions/.Modules/ReadSettings.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -595,23 +595,16 @@ function ValidateSettings {
$settings
)
Process {
if ($PSVersionTable.PSVersion.Major -lt 7) {
return
}

$settingsJson = ConvertTo-Json -InputObject $settings -Depth 99 -Compress
$settingsSchemaFile = Join-Path $PSScriptRoot "settings.schema.json" -Resolve

$result = ""
try{
$command = [scriptblock] {
$result = ''
Test-Json -Json $args[0] -SchemaFile $args[1] -ErrorVariable result -ErrorAction SilentlyContinue | Out-Null
return $result
}

if($PSVersionTable.PSVersion.Major -lt 6) { # Test-Json is not available in PS5.1
$result = pwsh -noprofile -Command $command -args $settingsJson, $settingsSchemaFile
}
else {
$result = Invoke-Command -ScriptBlock $command -ArgumentList $settingsJson, $settingsSchemaFile
}
Test-Json -Json $settingsJson -SchemaFile $settingsSchemaFile -ErrorVariable result -ErrorAction SilentlyContinue | Out-Null
}
catch {
OutputWarning "Error validating settings. Error: $($_.Exception.Message)"
Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The `DownloadProjectDependencies` action now downloads only artifacts from depen
- Issue 2204 - Workspace compilation ignores vsixFile setting
- Issue 2211 - Cannot create a release if a project contains only test apps
- Issue 2214 - Workspace compilation not working with external dependencies
- Fix "filename or extension is too long" error when validating settings on PS5.1 with large settings JSON
- Issue 2235 - Workspace compilation: only the first `customCodeCops` entry resolved when multiple relative paths were configured. Relative `customCodeCops` paths are now resolved against the project folder before being passed to the compiler.
- Issue 2265 - Creating a Performance Test App fails on Linux due to case-sensitive path lookup for the Performance Toolkit sample app

Expand Down
20 changes: 20 additions & 0 deletions Tests/ReadSettings.Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -540,5 +540,25 @@ InModuleScope ReadSettings { # Allows testing of private functions
Pop-Location
Remove-Item -Path $tempName -Recurse -Force
}

It 'ValidateSettings skips validation entirely on PS versions less than 7 without warning' {
Mock OutputWarning { }

$settings = @{ "someProp" = "someValue" }

if ($PSVersionTable.PSVersion.Major -ge 7) {
Mock Test-Json { }
ValidateSettings -settings $settings
# On PS7+, Test-Json is called directly for validation
Should -Invoke -CommandName Test-Json -Times 1
}
else {
# On PS < 7, validation is skipped entirely; Test-Json doesn't exist so we just verify no warning
ValidateSettings -settings $settings
}

# Verify no warning was output
Should -Invoke -CommandName OutputWarning -Times 0
}
Comment on lines +544 to +562
}
}
Loading