Clean up analyzer warnings across app search and ISO workflows (#4794)

* Clean up analyzer warnings

* Align analyzer warning cleanup policy

* Run PSScriptAnalyzer directly in unittests workflow

* Bind lazy-rendered buttons to click handlers

* Remove WinUtil performance tracing

* Fix Win11 ISO creator temp directory reuse
This commit is contained in:
Chris Titus
2026-07-02 12:05:25 -05:00
committed by GitHub
parent b72bfb03ba
commit 58d37bb461
45 changed files with 262 additions and 439 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ function Invoke-WPFAppxRemoval {
$selected = $sync.selectedAppx
$apps = $sync.configs.appxHashtable
$handle = Invoke-WPFRunspace -ParameterList @(("selected", $selected), ("apps", $apps)) -ScriptBlock {
Invoke-WPFRunspace -ParameterList @(("selected", $selected), ("apps", $apps)) -ScriptBlock {
param($selected, $apps)
$sync.ProcessRunning = $true
+1 -1
View File
@@ -35,7 +35,7 @@ function Invoke-WPFButton {
if ($buttonConfig.InvokeScript -and $buttonConfig.InvokeScript.Count -gt 0) {
foreach ($script in $buttonConfig.InvokeScript) {
if (-not [string]::IsNullOrWhiteSpace($script)) {
Invoke-Expression $script
Invoke-Command -ScriptBlock ([scriptblock]::Create($script)) -ErrorAction Stop
}
}
return
@@ -12,7 +12,7 @@ function Invoke-WPFFeatureInstall {
return
}
$handle = Invoke-WPFRunspace -ScriptBlock {
Invoke-WPFRunspace -ScriptBlock {
$Features = $sync.selectedFeatures
$sync.ProcessRunning = $true
if ($Features.count -eq 1) {
@@ -26,7 +26,7 @@ function Invoke-WPFFeatureInstall {
$Features | ForEach-Object {
Invoke-WinUtilFeatureInstall $_
$X++
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -value ($x/$CheckBox.Count) }
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -value ($x/$Features.Count) }
}
$sync.ProcessRunning = $false
+1 -1
View File
@@ -24,7 +24,7 @@ function Invoke-WPFInstall {
$packageSummary = Get-WinUtilPackageLogSummary -Packages $PackagesToInstall -Preference $ManagerPreference
Write-WinUtilLog -Component "Install" -Message "Install selected package(s): $($packageSummary -join '; ')"
$handle = Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -ScriptBlock {
Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -ScriptBlock {
param($PackagesToInstall, $ManagerPreference)
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToInstall -Preference $ManagerPreference
+1
View File
@@ -24,6 +24,7 @@ function Invoke-WPFRunspace {
#>
[CmdletBinding()]
[OutputType([System.IAsyncResult])]
Param (
$ScriptBlock,
$ArgumentList,
+24
View File
@@ -223,6 +223,18 @@ function Invoke-WPFUIElements {
$sync[$entryInfo.Name].Add_Unchecked({
$this.Content = $this.Tag.contentOff
})
if ($null -eq $sync.Buttons) {
$sync.Buttons = [System.Collections.Generic.List[PSObject]]::new()
}
if ($sync.Buttons -notcontains $toggleButton.Name) {
$toggleButton.Add_Click({
[System.Object]$Sender = $args[0]
Invoke-WPFButton $Sender.name
})
$sync.Buttons.Add($toggleButton.Name) | Out-Null
}
}
"Combobox" {
@@ -294,6 +306,18 @@ function Invoke-WPFUIElements {
$itemsControl.Items.Add($button) | Out-Null
$sync[$entryInfo.Name] = $button
if ($null -eq $sync.Buttons) {
$sync.Buttons = [System.Collections.Generic.List[PSObject]]::new()
}
if ($sync.Buttons -notcontains $button.Name) {
$button.Add_Click({
[System.Object]$Sender = $args[0]
Invoke-WPFButton $Sender.name
})
$sync.Buttons.Add($button.Name) | Out-Null
}
}
"RadioButton" {
+1 -1
View File
@@ -57,7 +57,7 @@ function Invoke-WPFtweaksbutton {
}
# The leading "," in the ParameterList is necessary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
$handle = Invoke-WPFRunspace -ParameterList @(("tweaks", $tweaksToRun), ("dnsProvider", $dnsProvider), ("completedSteps", $completedSteps), ("totalSteps", $totalSteps)) -ScriptBlock {
Invoke-WPFRunspace -ParameterList @(("tweaks", $tweaksToRun), ("dnsProvider", $dnsProvider), ("completedSteps", $completedSteps), ("totalSteps", $totalSteps)) -ScriptBlock {
param($tweaks, $dnsProvider, $completedSteps, $totalSteps)
$sync.ProcessRunning = $true