From 08b6f61798fc5b2f0f0fdcaa8e4f52ad58f29623 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 16:45:46 -0700 Subject: [PATCH 01/66] [release/v7.4.0-preview.6] Harden some problematic release tests (#20155) (#20254) --- .../Get-ChildItem.Tests.ps1 | 32 +++++++--- .../ConstrainedLanguageModules.Tests.ps1 | 32 ++++++++-- .../ConstrainedLanguageRestriction.Tests.ps1 | 60 ++++++++----------- .../PackageManagement.Tests.ps1 | 12 +++- .../engine/Module/ModulePath.Tests.ps1 | 2 +- 5 files changed, 89 insertions(+), 49 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.Tests.ps1 index 42c8a3e8bf..4c7fdfa529 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ChildItem.Tests.ps1 @@ -226,14 +226,29 @@ Describe "Get-ChildItem" -Tags "CI" { } It 'Works with Windows volume paths' -Skip:(!$IsWindows) { - $volume = (Get-Volume -DriveLetter $env:SystemDrive[0]).Path - $items = Get-ChildItem -LiteralPath "${volume}Windows" - Write-Verbose -Verbose "Trying files in '${volume}Windows'" - if (-not $items) { + $winPath = $env:windir + if (! $winPath) { + Set-ItResult -Skipped -Because "windir is null" + return + } + + $driveLetter = $winPath[0] + $winPartialPath = $winPath.SubString(3) # skip the drive letter, colon, and backslash + Write-Verbose -Verbose "Partial path is '$winPartialPath'" + $volume = (Get-Volume -DriveLetter $driveLetter).Path + if (! $volume) { + Set-ItResult -Skipped -Because "Get-Volume returned no volume for system drive '$driveLetter'" + return + } + + $items = Get-ChildItem -LiteralPath "${volume}${winPartialPath}" + Write-Verbose -Verbose "Trying files in '${volume}${winPartialPath}'" + if ($items.Count -eq 0) { Write-Verbose -Verbose "`$items is null!!" } - $items[0].Parent | Should -BeExactly "${volume}Windows" - $items | Should -HaveCount (Get-ChildItem $env:SystemRoot).Count + + $items[0].Parent.FullName | Should -BeExactly "${volume}${winPartialPath}" + $items | Should -HaveCount (Get-ChildItem $winPath).Count } It 'Works with Windows pipes' -Skip:(!$IsWindows) { @@ -294,7 +309,10 @@ Describe 'FileSystem Provider Formatting' -Tag "CI","RequireAdminOnWindows" { if ($IsWindows) { - $testcases += @{ expectedMode = "l----"; expectedModeWithoutHardlink = "l----"; itemType = "Junction"; itemName = "Junction-Directory"; fileAttributes = [System.IO.FileAttributes]::Directory -bor [System.IO.FileAttributes]::ReparsePoint; target = $targetDir1.FullName } + # arm64 adds the archive attribute + $junctionMode = (Test-IsWindowsArm64) ? "la---" : "l----" + $armFileAttributes = (Test-IsWindowsArm64) ? [System.IO.FileAttributes]"Directory,Archive,ReparsePoint" : [System.IO.FileAttributes]"Directory,ReparsePoint" + $testcases += @{ expectedMode = $junctionMode; expectedModeWithoutHardlink = $junctionMode; itemType = "Junction"; itemName = "Junction-Directory"; fileAttributes = $armFileAttributes; target = $targetDir1.FullName } $testcases += @{ expectedMode = "-a---"; expectedModeWithoutHardlink = "-a---"; itemType = "File"; itemName = "ArchiveFile"; fileAttributes = [System.IO.FileAttributes] "Archive"; target = $null } $testcases += @{ expectedMode = "la---"; expectedModeWithoutHardlink = "la---"; itemType = "SymbolicLink"; itemName = "SymbolicLink-File"; fileAttributes = [System.IO.FileAttributes]::Archive -bor [System.IO.FileAttributes]::ReparsePoint; target = $targetFile1.FullName } $testcases += @{ expectedMode = "la---"; expectedModeWithoutHardlink = "-a---"; itemType = "HardLink"; itemName = "HardLink"; fileAttributes = [System.IO.FileAttributes] "Archive"; target = $targetFile2.FullName } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageModules.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageModules.Tests.ps1 index 926be123d4..8c1333769d 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageModules.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageModules.Tests.ps1 @@ -622,6 +622,10 @@ try Describe "Import mix of trusted and untrusted manifest and module files" -Tags 'Feature','RequireAdminOnWindows' { It "Verifies that an untrusted manifest with a trusted module will not load under system lockdown" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } $manifestFileName = Join-Path $TestDrive "ImportUnTrustedManifestWithFnExport.psd1" $moduleFileName = Join-Path $TestDrive "ImportUnTrustedManifestWithFnExport_System32.psm1" @@ -642,8 +646,8 @@ try try { - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode + $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Import-Module -Name $manifestFileName -Force -ErrorAction Stop throw "No Exception!" @@ -704,6 +708,10 @@ try } It "Verifies that an untrusted module with nested trusted modules cannot load in a locked down system" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } $manifestFileName = Join-Path $TestDrive "ImportUnTrustedManifestWithTrustedModule.psd1" $moduleFileName = Join-Path $TestDrive "ImportUnTrustedManifestWithTrustedModule_System32.psm1" @@ -723,8 +731,8 @@ try try { - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode + $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Import-Module -Name $manifestFileName -Force -ErrorAction Stop throw "No Exception!" @@ -742,6 +750,10 @@ try } It "Verifies that an untrusted manifest containing all trusted modules does not load under system lock down" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } $moduleFileName1 = Join-Path $TestDrive "ImportUnTrustedManifestWithTrustedModules1_System32.psm1" $moduleFileName2 = Join-Path $TestDrive "ImportUnTrustedManifestWithTrustedModules2_System32.psm1" @@ -768,8 +780,8 @@ try try { - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode + $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Import-Module -Name $manifestFileName -Force -ErrorAction Stop throw "No Exception!" @@ -1313,6 +1325,10 @@ try } It "Verifies that importing untrusted manifest in lock down mode exports all functions by default" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } CreateManifestNames "ImportUntrustedManifestWithNoFnExport" @' @@ -1330,8 +1346,8 @@ try try { - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode + $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" $module = Import-Module -Name $manifestFileName -Force -PassThru } finally @@ -1376,6 +1392,10 @@ try } It "Verifies that importing untrusted module file in lock down mode exports all functions by default" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } CreateManifestNames "ImportUnTrustedModuleWithNoFnExport" @' @@ -1534,6 +1554,10 @@ try } It "New-Module succeeds in creating module with untrusted scriptblock in ConstrainedLanguage" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } $result = $null diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 index 72faa923f1..acd5a45939 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 @@ -966,12 +966,17 @@ try } It "Verifies a scriptblock from a trusted script file does not run as trusted" { + if (Test-IsWindowsArm64) { + Set-ItResult -Pending -Because "https://github.com/PowerShell/PowerShell/issues/20169" + return + } $result = $null try { Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode + # Wait for the lockdown mode to take effect $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" # Import untrusted module @@ -1027,6 +1032,7 @@ try Import-Module -Name $scriptModulePath -Force + $result1 = ModuleFn $result2 = ImportModuleFn } @@ -1046,9 +1052,7 @@ try $randomClassName = "class_$(Get-Random -Max 9999)" - $script = @' - class {0} {{ static Hello([string] $msg) {{ [System.Console]::WriteLine("Hello from: $msg") }} }} -'@ -f $randomClassName + $script = "class ${randomClassName} { static [string] GetLanguageMode() { return (Get-Variable -ValueOnly -Name ExecutionContext).SessionState.LanguageMode } }" $modulePathName = "modulePath_$(Get-Random -Max 9999)" $modulePath = Join-Path $testdrive $modulePathName @@ -1097,46 +1101,34 @@ try It "Verifies that classes cannot be created in script files running under constrained language" { - try - { - Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" - - & ($untrustedScriptFile) - throw "No Error!" + try { + $ps = [powershell]::Create("NewRunspace") + $ps.Runspace.LanguageMode = "ConstrainedLanguage" + $result = $ps.AddScript($untrustedScriptFile).Invoke() + $ps.Streams.Error[0].FullyQualifiedErrorId | Should -BeExactly "ClassesNotAllowedInConstrainedLanguage" -Because "Invoke-Command should fail in constrained language" } - catch - { - $expectedError = $_ + catch { + $_ | Should -BeNullOrEmpty -Because "exception '$_' unexpected." } - finally - { - Invoke-LanguageModeTestingSupportCmdlet -EnableFullLanguageMode -RevertLockdownMode + finally { + $ps.Dispose() } - - $expectedError.FullyQualifiedErrorId | Should -BeExactly "ClassesNotAllowedInConstrainedLanguage" } It "Verifies that classes cannot be created in untrusted script modules running under constrained language" { - - try - { - Invoke-LanguageModeTestingSupportCmdlet -SetLockdownMode - $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" - - Import-Module -Name $untrustedScriptModule -ErrorAction Stop - throw "No Error!" + try { + $ps = [powershell]::Create("NewRunspace") + $ps.Runspace.LanguageMode = "ConstrainedLanguage" + # importing the module whilst in constrained language makes it untrusted, even without lockdown mode + $ps.AddCommand("Import-Module").AddParameter("Name", $untrustedScriptModule).Invoke() + $ps.Streams.Error[0].FullyQualifiedErrorId | Should -BeExactly "ClassesNotAllowedInConstrainedLanguage" -Because "Import-Module should fail in constrained language" } - catch - { - $expectedError = $_ + catch { + $_ | Should -BeNullOrEmpty -Because "exception '$_' unexpected." } - finally - { - Invoke-LanguageModeTestingSupportCmdlet -EnableFullLanguageMode -RevertLockdownMode + finally { + $ps.Dispose() } - - $expectedError.FullyQualifiedErrorId | Should -BeExactly "ClassesNotAllowedInConstrainedLanguage" } It "Verifies that classes can be created in trusted script files running under constrained language" { diff --git a/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1 b/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1 index e6fdb981f1..0eaeaa03e6 100644 --- a/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1 +++ b/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1 @@ -67,9 +67,15 @@ Describe "PackageManagement Acceptance Test" -Tags "Feature" { AfterAll { $ProgressPreference = $SavedProgressPreference - Unregister-PackageSource -Source $localSourceName -ErrorAction Ignore - Unregister-PackageSource -Name $gallerySourceName -ErrorAction Ignore - Uninstall-Module NanoServerPackage -ErrorAction Ignore -WarningAction SilentlyContinue + try { + # non-fatal errors + Unregister-PackageSource -Source $localSourceName -ErrorAction Ignore + Unregister-PackageSource -Name $gallerySourceName -ErrorAction Ignore + Uninstall-Module NanoServerPackage -ErrorAction Ignore -WarningAction SilentlyContinue + } + catch { + Write-Warning "Failure in AfterAll: $_" + } } It "get-packageprovider" { diff --git a/test/powershell/engine/Module/ModulePath.Tests.ps1 b/test/powershell/engine/Module/ModulePath.Tests.ps1 index 5bf3b4e4c8..5861455e72 100644 --- a/test/powershell/engine/Module/ModulePath.Tests.ps1 +++ b/test/powershell/engine/Module/ModulePath.Tests.ps1 @@ -180,7 +180,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { try { $userConfig = '{ "PSModulePath": "myUserPath" }' Set-Content -Path $userConfigPath -Value $userConfig -Force - $out = & $powershell -noprofile -command 'powershell.exe -noprofile -command $env:PSModulePath' + $out = & $powershell -noprofile -command 'powershell.exe -noprofile -command `$env:PSModulePath' $out | Should -Not -BeLike 'myUserPath;*' } finally { From 67310dfc2a95e596a347400ec87606b7e7d05140 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 16:50:09 -0700 Subject: [PATCH 02/66] [release/v7.4.0-preview.6] Skip the test on x86 as `InstallDate` is not visible on `Wow64` (#20165) (#20255) --- .../Get-ComputerInfo.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 index 824de39102..8d68a2aaaf 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 @@ -232,9 +232,9 @@ function Get-PropertyNamesForComputerInfoTest "WindowsVersion", "WindowsUBR") - if ([System.Management.Automation.Platform]::IsIoT) + if ([System.Management.Automation.Platform]::IsIoT -or (Test-IsWinWow64)) { - Write-Verbose -Verbose -Message "WindowsInstallDateFromRegistry is not supported on IoT." + Write-Verbose -Verbose -Message "WindowsInstallDateFromRegistry is not supported on current platform." } else { From 5ba9159454d18cd1c852f390ff76674a70848fee Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:17:53 -0700 Subject: [PATCH 03/66] [release/v7.4.0-preview.6] Fix typo `donet` to `dotnet` in build scripts and pipelines (#20122) (#20256) --- build.psm1 | 4 ++-- .../azureDevOps/templates/compliance/apiscan.yml | 4 ++-- .../azureDevOps/templates/linux-packaging.yml | 4 ++-- tools/releaseBuild/azureDevOps/templates/linux.yml | 4 ++-- .../azureDevOps/templates/mac-package-build.yml | 8 ++++---- tools/releaseBuild/azureDevOps/templates/mac.yml | 8 ++++---- tools/releaseBuild/azureDevOps/templates/nuget.yml | 4 ++-- .../azureDevOps/templates/release-GlobalToolTest.yml | 12 ++++++------ .../azureDevOps/templates/release-SDKTests.yml | 8 ++++---- .../templates/release-ValidateFxdPackage.yml | 4 ++-- .../azureDevOps/templates/testartifacts.yml | 8 ++++---- .../azureDevOps/templates/windows-hosted-build.yml | 4 ++-- .../azureDevOps/templates/windows-packaging.yml | 4 ++-- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/build.psm1 b/build.psm1 index d08124e8a8..a226bde534 100644 --- a/build.psm1 +++ b/build.psm1 @@ -19,8 +19,8 @@ $script:Options = $null $dotnetMetadata = Get-Content $PSScriptRoot/DotnetRuntimeMetadata.json | ConvertFrom-Json $dotnetCLIChannel = $dotnetMetadata.Sdk.Channel $dotnetCLIQuality = $dotnetMetadata.Sdk.Quality -$dotnetAzureFeed = if (-not $env:__DONET_RUNTIME_FEED ) { $dotnetMetadata.Sdk.azureFeed } -$dotnetAzureFeedSecret = $env:__DONET_RUNTIME_FEED_KEY +$dotnetAzureFeed = if (-not $env:__DOTNET_RUNTIME_FEED ) { $dotnetMetadata.Sdk.azureFeed } +$dotnetAzureFeedSecret = $env:__DOTNET_RUNTIME_FEED_KEY $dotnetSDKVersionOveride = $dotnetMetadata.Sdk.sdkImageOverride $dotnetCLIRequiredVersion = $(Get-Content $PSScriptRoot/global.json | ConvertFrom-Json).Sdk.Version diff --git a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml index 207bdf0d29..bf631b3acc 100644 --- a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml +++ b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml @@ -40,8 +40,8 @@ jobs: retryCountOnTaskFailure: 2 displayName: 'Bootstrap' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | Import-Module .\build.psm1 -force diff --git a/tools/releaseBuild/azureDevOps/templates/linux-packaging.yml b/tools/releaseBuild/azureDevOps/templates/linux-packaging.yml index 928832376f..4439ded9f2 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux-packaging.yml @@ -253,8 +253,8 @@ jobs: condition: and(succeeded(), ne(variables['SkipBuild'], 'true')) workingDirectory: $(PowerShellRoot) env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - powershell: | try { diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index 6d1d3b83fa..a65045ce32 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -62,8 +62,8 @@ jobs: condition: and(succeeded(), ne(variables['SkipBuild'], 'true')) workingDirectory: $(PowerShellRoot) env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | try { diff --git a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml index cce35c61e9..f3801deaa9 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml @@ -119,8 +119,8 @@ jobs: } displayName: 'Bootstrap VM' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | # Add -SkipReleaseChecks as a mitigation to unblock release. @@ -133,8 +133,8 @@ jobs: } displayName: 'Package' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' diff --git a/tools/releaseBuild/azureDevOps/templates/mac.yml b/tools/releaseBuild/azureDevOps/templates/mac.yml index 7bf1a2121d..f13c00ef42 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac.yml @@ -43,8 +43,8 @@ jobs: tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap displayName: 'Bootstrap VM' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml parameters: @@ -58,8 +58,8 @@ jobs: $env:AzDevOpsFeedPAT2 = $null displayName: 'Build' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' diff --git a/tools/releaseBuild/azureDevOps/templates/nuget.yml b/tools/releaseBuild/azureDevOps/templates/nuget.yml index eee32ed82c..749956682d 100644 --- a/tools/releaseBuild/azureDevOps/templates/nuget.yml +++ b/tools/releaseBuild/azureDevOps/templates/nuget.yml @@ -60,8 +60,8 @@ jobs: Start-PSBootStrap -Verbose displayName: Bootstrap env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - task: DownloadBuildArtifacts@0 displayName: 'Download PowerShell build artifacts - finalResults' diff --git a/tools/releaseBuild/azureDevOps/templates/release-GlobalToolTest.yml b/tools/releaseBuild/azureDevOps/templates/release-GlobalToolTest.yml index bd353baaec..cc6af2d852 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-GlobalToolTest.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-GlobalToolTest.yml @@ -61,8 +61,8 @@ jobs: displayName: Install .NET env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | $branch = $ENV:BUILD_SOURCEBRANCH @@ -85,8 +85,8 @@ jobs: displayName: Install global tool env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | $toolPath = "$(System.DefaultWorkingDirectory)/toolPath/${{ parameters.globalToolExeName }}" @@ -148,5 +148,5 @@ jobs: } displayName: Basic validation env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) diff --git a/tools/releaseBuild/azureDevOps/templates/release-SDKTests.yml b/tools/releaseBuild/azureDevOps/templates/release-SDKTests.yml index 45f1507470..2279c3325e 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-SDKTests.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-SDKTests.yml @@ -97,8 +97,8 @@ jobs: displayName: Install .NET env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 @@ -136,8 +136,8 @@ jobs: displayName: Restore and execute tests env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - task: PublishTestResults@2 displayName: 'Publish Test Results **\test-hosting.xml' diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidateFxdPackage.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidateFxdPackage.yml index 6843cf2a2d..1aa88af914 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidateFxdPackage.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidateFxdPackage.yml @@ -38,8 +38,8 @@ jobs: Write-Verbose -Message "Installing .NET SDK completed." -Verbose displayName: Install .NET env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | Get-ChildItem -Path '$(Pipeline.Workspace)/releasePipeline/finalResults' -Recurse diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index b708093675..09f5c5bce5 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -25,8 +25,8 @@ jobs: Start-PSBootstrap displayName: Bootstrap env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | Import-Module ./build.psm1 @@ -86,8 +86,8 @@ jobs: Start-PSBootstrap displayName: Bootstrap env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | Import-Module ./build.psm1 diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml index 539992c63c..b533061178 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml @@ -66,8 +66,8 @@ jobs: tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols @params displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols zip' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | $packageName = (Get-ChildItem '$(Build.ArtifactStagingDirectory)\Symbols_$(Architecture)').FullName diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index ffc3225e38..91a5c15f11 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -259,8 +259,8 @@ jobs: $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' @params displayName: 'Build Windows Universal - $(Architecture) Package' env: - __DONET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) - __DONET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) + __DOTNET_RUNTIME_FEED: $(RUNTIME_SOURCEFEED) + __DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY) - pwsh: | Get-ChildItem '$(System.ArtifactsDirectory)\pkgSigned' | ForEach-Object { From d9620c7bcebd088ec4b5d4a44ea2b59a17db88d6 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:19:05 -0700 Subject: [PATCH 04/66] [release/v7.4.0-preview.6] Add mariner arm64 to PMC release (#20176) (#20257) --- tools/packages.microsoft.com/mapping.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/packages.microsoft.com/mapping.json b/tools/packages.microsoft.com/mapping.json index a1ea93f4e0..48e93bba72 100644 --- a/tools/packages.microsoft.com/mapping.json +++ b/tools/packages.microsoft.com/mapping.json @@ -36,6 +36,14 @@ "PackageFormat": "PACKAGE_NAME-POWERSHELL_RELEASE-1.cm.x86_64.rpm", "channel": "stable" }, + { + "url": "cbl-mariner-2.0-preview-Microsoft-aarch64", + "distribution": [ + "bionic" + ], + "PackageFormat": "PACKAGE_NAME-POWERSHELL_RELEASE-1.cm.aarch64.rpm", + "channel": "preview" + }, { "url": "cbl-mariner-2.0-preview-Microsoft-x86_64", "distribution": [ From 648461a336b0c00ae9f1d124a95ca605b276f169 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:21:19 -0700 Subject: [PATCH 05/66] [release/v7.4.0-preview.6] Start using new packages.microsoft.com cli (#20141) (#20258) --- .../azureDevOps/releasePipeline.yml | 18 ++++++++- .../release-PublishPackageMsftCom.yml | 40 ++++++++++++++++--- .../templates/release-ReleaseToNuGet.yml | 9 +++++ 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index 51117ca99d..5ca465a74f 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -1,9 +1,19 @@ trigger: none # needed to disable CI trigger and allow manual trigger -# when the branch is same as pipline source, the latest build from the source is used. +# when the branch is same as pipeline source, the latest build from the source is used. # all environment used are for manual tasks and approvals. +parameters: + - name: skipPackagesMsftComPublish + displayName: Skip actual publishing to Packages.microsoft.com, AFTER we upload it. Used to test the publishing script. + default: false + type: boolean + - name: skipNugetPublish + displayName: Skip nuget publishing. Used in testing publishing stage. + default: false + type: boolean + resources: pipelines: - pipeline: releasePipeline @@ -17,7 +27,7 @@ resources: type: git trigger: none name: Internal-PowerShellTeam-Tools - ref: master + ref: main-mirror variables: - name: runCodesignValidationInjection @@ -340,6 +350,8 @@ stages: steps: - template: templates/release-ReleaseToNuGet.yml + parameters: + skipPublish: ${{ parameters.skipNugetPublish }} - job: PublishPkgsMsftCom @@ -353,6 +365,8 @@ stages: - group: 'packages.microsoft.com' steps: - template: templates/release-PublishPackageMsftCom.yml + parameters: + skipPublish: ${{ parameters.skipPackagesMsftComPublish }} - stage: PublishSymbols displayName: Publish symbols diff --git a/tools/releaseBuild/azureDevOps/templates/release-PublishPackageMsftCom.yml b/tools/releaseBuild/azureDevOps/templates/release-PublishPackageMsftCom.yml index b5dc97b9ab..0333c77b88 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-PublishPackageMsftCom.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-PublishPackageMsftCom.yml @@ -1,3 +1,8 @@ +parameters: + - name: skipPublish + default: false + type: boolean + steps: - template: release-SetReleaseTagAndContainerName.yml @@ -9,19 +14,44 @@ steps: displayName: Set Package version - pwsh: | - git clone https://$(AzureDevOpsPat)@mscodehub.visualstudio.com/PowerShellCore/_git/Internal-PowerShellTeam-Tools '$(Pipeline.Workspace)/tools' + $branch = 'main-mirror' + $gitArgs = "clone", + "--verbose", + "--branch", + "$branch", + "https://$(AzureDevOpsPat)@mscodehub.visualstudio.com/PowerShellCore/_git/Internal-PowerShellTeam-Tools", + '$(Pipeline.Workspace)/tools' + $gitArgs | Write-Verbose -Verbose + git $gitArgs displayName: Clone Internal-PowerShellTeam-Tools from MSCodeHub +- task: PipAuthenticate@1 + inputs: + artifactFeeds: 'pmc' + pythonDownloadServiceConnections: pmcDownload + +- pwsh: | + pip install pmc-cli + + $newPath = (resolve-path '~/.local/bin').providerpath + $vstsCommandString = "vso[task.setvariable variable=PATH]${env:PATH}:$newPath" + Write-Host "sending " + $vstsCommandString + Write-Host "##$vstsCommandString" + displayName: Install pmc cli + - pwsh: | $metadata = Get-Content -Path "$(Build.SourcesDirectory)/tools/metadata.json" -Raw | ConvertFrom-Json - Write-Verbose -Verbose "$(ReleaseTag) $(RepoClientCliClientID) $(RepoClientCliSecret) $(AzureVersion) $($metadata.LTSRelease.Latest)" $params = @{ ReleaseTag = "$(ReleaseTag)" - AadClientId = "$(RepoClientCliClientID)" - AadClientSecret = "$(RepoClientCliSecret)" + AadClientId = "$(PmcCliClientID)" BlobFolderName = "$(AzureVersion)" LTS = $metadata.LTSRelease.Latest ForProduction = $true + SkipPublish = $${{ parameters.skipPublish }} + MappingFilePath = '$(System.DefaultWorkingDirectory)/tools/packages.microsoft.com/mapping.json' } - & '$(Pipeline.Workspace)/tools/packages.microsoft.com/releaseLinuxPackages.ps1' -MappingFilePath '$(System.DefaultWorkingDirectory)/tools/packages.microsoft.com/mapping.json' @params + + $params | Out-String -width 9999 -Stream | write-Verbose -Verbose + + & '$(Pipeline.Workspace)/tools/packages.microsoft.com-v4/releaseLinuxPackages.ps1' @params displayName: Run release script diff --git a/tools/releaseBuild/azureDevOps/templates/release-ReleaseToNuGet.yml b/tools/releaseBuild/azureDevOps/templates/release-ReleaseToNuGet.yml index 117cf8f91d..33a72f56bb 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ReleaseToNuGet.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ReleaseToNuGet.yml @@ -1,5 +1,11 @@ +parameters: + - name: skipPublish + default: false + type: boolean + steps: - task: DownloadPipelineArtifact@2 + condition: and(eq('${{ parameters.skipPublish }}', 'false'), succeeded()) inputs: source: specific project: PowerShellCore @@ -12,6 +18,7 @@ steps: path: '$(Pipeline.Workspace)/releasePipeline/finalResults' - task: DownloadPipelineArtifact@2 + condition: and(eq('${{ parameters.skipPublish }}', 'false'), succeeded()) inputs: source: specific project: PowerShellCore @@ -37,9 +44,11 @@ steps: Get-ChildItem "$(Pipeline.Workspace)/release" -recurse displayName: Download and capture nupkgs + condition: and(eq('${{ parameters.skipPublish }}', 'false'), succeeded()) - task: NuGetCommand@2 displayName: 'NuGet push' + condition: and(eq('${{ parameters.skipPublish }}', 'false'), succeeded()) inputs: command: push packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg' From d5e2ddb9840cab52d90f40ea1391d0b3da53e2d4 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:22:25 -0700 Subject: [PATCH 06/66] [release/v7.4.0-preview.6] Continued improvement to tests for release automation (#20182) (#20259) --- .../ConstrainedLanguageRestriction.Tests.ps1 | 2 +- .../PowerShellGet/PowerShellGet.Tests.ps1 | 34 +++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 index acd5a45939..398bc49271 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 @@ -83,7 +83,7 @@ try $result = Get-Command NestedFn1 2> $null; return ($result -ne $null) '@ - $isCommandAccessible = powershell.exe -noprofile -nologo -c $command + $isCommandAccessible = pwsh.exe -noprofile -nologo -c $command } finally { diff --git a/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1 b/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1 index ef9eec8a0c..fb5d632765 100644 --- a/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1 +++ b/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1 @@ -104,7 +104,24 @@ function Initialize function Remove-InstalledModules { - Get-InstalledModule -Name $TestModule -AllVersions -ErrorAction SilentlyContinue | PowerShellGet\Uninstall-Module -Force + try { + $mod = Get-InstalledModule -Name $TestModule -AllVersions -ErrorAction SilentlyContinue + if ($null -eq $mod) { + return + } + + if (Get-Module -Name $TestModule -ErrorAction Ignore) { + Remove-Module -Force -Name $TestModule + } + + $installedPath = $mod.InstalledLocation + if (Test-Path $installedPath) { + Remove-Item -Force -Recurse $installedPath -ErrorAction Ignore + } + } + catch { + Write-Warning "Remove-InstalledModules: $_" + } } Describe "PowerShellGet - Module tests" -tags "Feature" { @@ -172,7 +189,20 @@ Describe "PowerShellGet - Module tests (Admin)" -Tags @('Feature', 'RequireAdmin function Remove-InstalledScripts { - Get-InstalledScript -Name $TestScript -ErrorAction SilentlyContinue | Uninstall-Script -Force + $installedScript = Get-InstalledScript -Name $TestScript -ErrorAction SilentlyContinue + if ($null -eq $installedScript) { + return + } + + $scriptPath = Join-Path ${installedScript}.InstalledLocation "${TestScript}.ps1" + if (test-Path -Type Leaf -Path $scriptPath) { + Remove-Item -Force -Path $scriptPath -ErrorAction Ignore + } + + $xmlPath = Join-Path ${installedScript}.InstalledLocation InstalledScriptInfos "${TestScript}_InstalledScriptInfo.xml" + if (test-Path -Type Leaf -Path $xmlPath) { + Remove-Item -Force -Path $xmlPath -ErrorAction Ignore + } } Describe "PowerShellGet - Script tests" -tags "Feature" { From 1c22f909ed556f26da4ba19080a5e934af1c50d3 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:24:36 -0700 Subject: [PATCH 07/66] [release/v7.4.0-preview.6] Enable `vPack` provenance data (#20220) (#20260) --- tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml index b6d18b8eaa..61371fcfaa 100644 --- a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml +++ b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml @@ -109,7 +109,7 @@ jobs: platforms: x64 target: '$(System.ArtifactsDirectory)' owner: tplunk - provData: false + provData: true version: '$(vpackVersion)' vpackToken: $(vPackPat) condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual')) From a0cfb3ca1f3eced3172b150f4c15b8e5c07712c0 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:37:13 -0700 Subject: [PATCH 08/66] [release/v7.4.0-preview.6] Bump `Microsoft.Management.Infrastructure` to 3.0.0-preview.2 (#20226) (#20261) --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index a53b38659e..281162df4c 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -45,7 +45,7 @@ - + From 264e30e6fced71a47672655e0d9364b34806d386 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 11 Sep 2023 17:38:08 -0700 Subject: [PATCH 09/66] [release/v7.4.0-preview.6] Bump Microsoft.Management.Infrastructure (continued) (#20224) (#20262) --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj index b19d33fdfb..ea8692d141 100644 --- a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj +++ b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj @@ -8,7 +8,7 @@ 11.0 - + From 35d0be80dfe989656e35433e37164b1ceae25d93 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:04:12 -0700 Subject: [PATCH 10/66] [release/v7.4.0-preview.6] Put the calls to `Set-AzDoProjectInfo` and Set-AzDoAuthToken` in the right order (#20306) (#20347) --- tools/releaseBuild/azureDevOps/releasePipeline.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index 5ca465a74f..72123ba7d8 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -210,8 +210,8 @@ stages: - pwsh: | Get-ChildItem -Path $(Build.SourcesDirectory) Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName Release-Automation + Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) $packageBuildID = $(resources.pipeline.releasePipeline.runID) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $buildInvocationInfo = Start-AzDOBuild -BuildDefinitionId 10 -BuildArguments @{ POWERSHELL_PACKAGE_BUILD_BUILDID = $packageBuildID } -Tag $metadata.ReleaseVersion, 'InProgress' -PassThru @@ -253,8 +253,8 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName Release-Automation + Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $azDOBuild = Get-AzDOBuild -buildDefinitionId 10 -MaximumResult 100 | Where-Object { $_.tags -in $metadata.ReleaseVersion } $azDoBuild | Remove-AzDOBuildTag -tag 'InProgress' -Pass | Add-AzDOBuildTag -tag 'SignedOff' @@ -434,8 +434,8 @@ stages: path: '$(Pipeline.Workspace)/releasePipeline/metadata' - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName PowerShell + Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $buildInvocationInfo = Start-AzDOBuild -BuildDefinitionId 49 -Tag $metadata.ReleaseVersion, 'InProgress' -PassThru Write-Verbose -Verbose "Kicked off snap build: $($buildInvocationInfo.WebUrl)" @@ -475,8 +475,8 @@ stages: path: '$(Pipeline.Workspace)/releasePipeline/metadata' - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName PowerShell + Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $azDOBuild = Get-AzDOBuild -buildDefinitionId 49 -MaximumResult 100 | Where-Object { $_.tags -in $metadata.ReleaseVersion } $azDoBuild | Remove-AzDOBuildTag -tag 'InProgress' -Pass | Add-AzDOBuildTag -tag 'SignedOff' @@ -579,8 +579,8 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force - Set-AzDoAuthToken -Token $(MSCODEHUBPAT) Set-AzDoProjectInfo -ProjectOwner mscodehub -ProjectName PowerShellCore + Set-AzDoAuthToken -Token $(MSCODEHUBPAT) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $releaseVersion = $metadata.ReleaseVersion -replace '^v','' $semanticVersion = [System.Management.Automation.SemanticVersion]$releaseVersion From 90f64aa02ca389c70d62167238ef67abb84ba289 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:10:00 -0700 Subject: [PATCH 11/66] [release/v7.4.0-preview.6] Release build: Change the names of the PATs (#20307) (#20349) --- tools/releaseBuild/azureDevOps/releasePipeline.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index 72123ba7d8..b893a8f5cf 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -41,6 +41,7 @@ variables: - name: BUILDSECMON_OPT_IN value: true - group: ReleasePipelineSecrets + - group: PipelineExecutionPats stages: - stage: MSIXBundle @@ -211,7 +212,7 @@ stages: Get-ChildItem -Path $(Build.SourcesDirectory) Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName Release-Automation - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) + Set-AzDoAuthToken -Token $(powershellRelExecutionPat) $packageBuildID = $(resources.pipeline.releasePipeline.runID) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $buildInvocationInfo = Start-AzDOBuild -BuildDefinitionId 10 -BuildArguments @{ POWERSHELL_PACKAGE_BUILD_BUILDID = $packageBuildID } -Tag $metadata.ReleaseVersion, 'InProgress' -PassThru @@ -254,7 +255,7 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName Release-Automation - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) + Set-AzDoAuthToken -Token $(powershellRelExecutionPat) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $azDOBuild = Get-AzDOBuild -buildDefinitionId 10 -MaximumResult 100 | Where-Object { $_.tags -in $metadata.ReleaseVersion } $azDoBuild | Remove-AzDOBuildTag -tag 'InProgress' -Pass | Add-AzDOBuildTag -tag 'SignedOff' @@ -435,7 +436,7 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName PowerShell - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) + Set-AzDoAuthToken -Token $(powershellRelExecutionPat) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $buildInvocationInfo = Start-AzDOBuild -BuildDefinitionId 49 -Tag $metadata.ReleaseVersion, 'InProgress' -PassThru Write-Verbose -Verbose "Kicked off snap build: $($buildInvocationInfo.WebUrl)" @@ -476,7 +477,7 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force Set-AzDoProjectInfo -ProjectOwner PowerShell-Rel -ProjectName PowerShell - Set-AzDoAuthToken -Token $(RELEASEAUTOMATIONPAT) + Set-AzDoAuthToken -Token $(powershellRelExecutionPat) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $azDOBuild = Get-AzDOBuild -buildDefinitionId 49 -MaximumResult 100 | Where-Object { $_.tags -in $metadata.ReleaseVersion } $azDoBuild | Remove-AzDOBuildTag -tag 'InProgress' -Pass | Add-AzDOBuildTag -tag 'SignedOff' @@ -580,7 +581,7 @@ stages: - pwsh: | Import-Module $(Build.SourcesDirectory)\ReleaseTools\AzDO -Force Set-AzDoProjectInfo -ProjectOwner mscodehub -ProjectName PowerShellCore - Set-AzDoAuthToken -Token $(MSCODEHUBPAT) + Set-AzDoAuthToken -Token $(mscodehubBuildExecutionPat) $metadata = Get-Content -Raw -Path '$(Pipeline.Workspace)/releasePipeline/metadata/release.json' | ConvertFrom-Json $releaseVersion = $metadata.ReleaseVersion -replace '^v','' $semanticVersion = [System.Management.Automation.SemanticVersion]$releaseVersion From f57878b7848bcb663a83bc00754771f07ae04e51 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:49:57 -0700 Subject: [PATCH 12/66] [release/v7.4.0-preview.6] Remove the comment trigger from feedback provider (#20136) (#20346) --- .../Subsystem/FeedbackSubsystem/FeedbackHub.cs | 7 +++---- .../FeedbackSubsystem/IFeedbackProvider.cs | 13 ++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/FeedbackHub.cs b/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/FeedbackHub.cs index 7dfe79a2cd..588cf086d4 100644 --- a/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/FeedbackHub.cs +++ b/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/FeedbackHub.cs @@ -183,12 +183,10 @@ namespace System.Management.Automation.Subsystem.Feedback private static bool CanSkip(IEnumerable providers) { - const FeedbackTrigger possibleTriggerOnSuccess = FeedbackTrigger.Success | FeedbackTrigger.Comment; - bool canSkip = true; foreach (IFeedbackProvider provider in providers) { - if ((provider.Trigger & possibleTriggerOnSuccess) != 0) + if (provider.Trigger.HasFlag(FeedbackTrigger.Success)) { canSkip = false; break; @@ -249,7 +247,8 @@ namespace System.Management.Automation.Subsystem.Feedback if (IsPureComment(tokens)) { - trigger = FeedbackTrigger.Comment; + // Don't trigger anything in this case. + return false; } else if (questionMarkValue) { diff --git a/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/IFeedbackProvider.cs b/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/IFeedbackProvider.cs index d028e5baa6..1446983f79 100644 --- a/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/IFeedbackProvider.cs +++ b/src/System.Management.Automation/engine/Subsystem/FeedbackSubsystem/IFeedbackProvider.cs @@ -18,32 +18,27 @@ namespace System.Management.Automation.Subsystem.Feedback [Flags] public enum FeedbackTrigger { - /// - /// The last command line is comment only. - /// - Comment = 0x0001, - /// /// The last command line executed successfully. /// - Success = 0x0002, + Success = 0x0001, /// /// The last command line failed due to a command-not-found error. /// This is a special case of . /// - CommandNotFound = 0x0004, + CommandNotFound = 0x0002, /// /// The last command line failed with an error record. /// This includes the case of command-not-found error. /// - Error = CommandNotFound | 0x0008, + Error = CommandNotFound | 0x0004, /// /// All possible triggers. /// - All = Comment | Success | Error + All = Success | Error } /// From c1b7226dd0f3058fc1a49504def6cd62366d1a1e Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:51:17 -0700 Subject: [PATCH 13/66] [release/v7.4.0-preview.6] Bump `Microsoft.CodeAnalysis.CSharp` from 4.7.0-2.final to 4.7.0 (#20146) (#20350) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- .../PSVersionInfoGenerator/PSVersionInfoGenerator.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 328718e9c0..18880b1b68 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj b/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj index c797177506..d46e259fb5 100644 --- a/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj +++ b/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj @@ -13,7 +13,7 @@ - + From 42f43a1d00bcefe18601235071cc0792d766ac0e Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:52:02 -0700 Subject: [PATCH 14/66] [release/v7.4.0-preview.6] Bump `Microsoft.NET.Test.Sdk` from 17.7.0 to 17.7.1 (#20130) (#20351) --- test/xUnit/xUnit.tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index 6665f8a475..193a012f43 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -27,7 +27,7 @@ - + From ea9cf42d5d1a6b8923f3eb813855110c09ed9c40 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:52:40 -0700 Subject: [PATCH 15/66] [release/v7.4.0-preview.6] Bump actions/checkout from 3 to 4 (#20205) (#20352) --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/markdownLink.yml | 4 ++-- .github/workflows/markdownLinkDaily.yml | 2 +- .github/workflows/rebase.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6463ce67ff..a18163af84 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: '0' diff --git a/.github/workflows/markdownLink.yml b/.github/workflows/markdownLink.yml index b7df90232f..9f66988fe9 100644 --- a/.github/workflows/markdownLink.yml +++ b/.github/workflows/markdownLink.yml @@ -12,7 +12,7 @@ jobs: markdown-link-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: gaurav-nelson/github-action-markdown-link-check@v1 with: use-quiet-mode: 'yes' @@ -26,7 +26,7 @@ jobs: statuses: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Full git history is needed to get a proper # list of changed files within `super-linter` diff --git a/.github/workflows/markdownLinkDaily.yml b/.github/workflows/markdownLinkDaily.yml index 7a4a1259a6..557b801273 100644 --- a/.github/workflows/markdownLinkDaily.yml +++ b/.github/workflows/markdownLinkDaily.yml @@ -18,7 +18,7 @@ jobs: if: github.repository == 'PowerShell/PowerShell' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check Links uses: gaurav-nelson/github-action-markdown-link-check@v1 with: diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 05cb478196..faf5ddda53 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Post rebase started comment to pull request From 3f96e9e2c02b95161d8399475520e230ce6a822a Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:53:32 -0700 Subject: [PATCH 16/66] [release/v7.4.0-preview.6] Bump JsonSchema.Net from 5.1.3 to 5.2.1 (#20193) (#20353) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 18880b1b68..01dc6212ac 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -35,7 +35,7 @@ - + From c2621277bd2a8ee3110306a24ad5b3c20af69638 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 10:54:06 -0700 Subject: [PATCH 17/66] [release/v7.4.0-preview.6] Bump Markdig.Signed from 0.32.0 to 0.33.0 (#20186) (#20354) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 01dc6212ac..9658b03d2e 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -8,7 +8,7 @@ - + From 26fce6118562b84aa4bef8e4762edf6a0083154d Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 11:06:21 -0700 Subject: [PATCH 18/66] [release/v7.4.0-preview.6] Bump `Microsoft.NET.Test.Sdk` from 17.7.1 to 17.7.2 (#20185) (#20355) --- test/xUnit/xUnit.tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index 193a012f43..b3daa34dd7 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -27,7 +27,7 @@ - + From 3c66c99a708f1ca44c7b2530f4a974b9bc8b74d2 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 11:07:44 -0700 Subject: [PATCH 19/66] [release/v7.4.0-preview.6] Bump `JsonSchema.Net` from 5.2.1 to 5.2.5 (#20225) (#20356) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 9658b03d2e..7658d48c8f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -35,7 +35,7 @@ - + From 1f5e71178744209c6e7f3f74df368b9dcf2c54bc Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 11:08:36 -0700 Subject: [PATCH 20/66] [release/v7.4.0-preview.6] Bump `xunit.runner.visualstudio` from `2.5.0` to `2.5.1` (#20294) (#20357) --- test/xUnit/xUnit.tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index b3daa34dd7..577150aba2 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -25,7 +25,7 @@ - + From 9f0044315dee6e0fa7539fd6b5d15d56411f2274 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 11:21:07 -0700 Subject: [PATCH 21/66] [release/v7.4.0-preview.6] Add mapping for mariner arm64 stable (#20213) (#20348) --- tools/packages.microsoft.com/mapping.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/packages.microsoft.com/mapping.json b/tools/packages.microsoft.com/mapping.json index 48e93bba72..f9d673d548 100644 --- a/tools/packages.microsoft.com/mapping.json +++ b/tools/packages.microsoft.com/mapping.json @@ -28,6 +28,14 @@ ], "PackageFormat": "PACKAGE_NAME-POWERSHELL_RELEASE-1.rh.x86_64.rpm" }, + { + "url": "cbl-mariner-2.0-prod-Microsoft-aarch64", + "distribution": [ + "bionic" + ], + "PackageFormat": "PACKAGE_NAME-POWERSHELL_RELEASE-1.cm.aarch64.rpm", + "channel": "stable" + }, { "url": "cbl-mariner-2.0-prod-Microsoft-x86_64", "distribution": [ From 094033c7c99a01aede9f145a6096b827046173f0 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 12:10:21 -0700 Subject: [PATCH 22/66] [release/v7.4.0-preview.6] Use `fxdependent-win-desktop` runtime for compliance runs (#20326) (#20359) Co-authored-by: Aditya Patwardhan --- tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml index bf631b3acc..e15a42ff63 100644 --- a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml +++ b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml @@ -55,7 +55,7 @@ jobs: - pwsh: | Import-Module .\build.psm1 -force Find-DotNet - Start-PSBuild -Configuration StaticAnalysis -PSModuleRestore -Clean + Start-PSBuild -Configuration StaticAnalysis -PSModuleRestore -Clean -Runtime fxdependent-win-desktop $OutputFolder = Split-Path (Get-PSOutput) Write-Host "##vso[task.setvariable variable=BinDir]$OutputFolder" From 21600d6327039b4146fe6de753be1b3d52e67b5b Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 12:29:00 -0700 Subject: [PATCH 23/66] [release/v7.4.0-preview.6] Update .NET SDK to version 8.0.100-rc.1.23455.8 (#20269) (#20358) --- DotnetRuntimeMetadata.json | 4 ++-- build.psm1 | 16 ++++++++++++++++ global.json | 2 +- ...rosoft.PowerShell.Commands.Diagnostics.csproj | 2 +- ...crosoft.PowerShell.Commands.Management.csproj | 2 +- .../Microsoft.PowerShell.Commands.Utility.csproj | 6 +++--- .../Microsoft.PowerShell.CoreCLR.Eventing.csproj | 2 +- .../Microsoft.PowerShell.SDK.csproj | 8 ++++---- .../Microsoft.WSMan.Management.csproj | 2 +- src/ResGen/ResGen.csproj | 2 +- .../System.Management.Automation.csproj | 16 ++++++++-------- .../engine/parser/ast.cs | 3 +-- .../engine/remoting/commands/PSRemotingCmdlet.cs | 8 ++++---- .../engine/remoting/commands/ReceivePSSession.cs | 6 +++--- .../namespaces/FileSystemProvider.cs | 12 +----------- src/TypeCatalogGen/TypeCatalogGen.csproj | 2 +- test/hosting/hosting.tests.csproj | 1 - .../BenchmarkDotNet.Extensions.csproj | 4 ++-- .../ResultsComparer/ResultsComparer.csproj | 2 +- ...crosoft.PowerShell.NamedPipeConnection.csproj | 2 +- test/tools/TestExe/TestExe.csproj | 2 +- test/tools/TestService/TestService.csproj | 4 ++-- test/tools/UnixSocket/UnixSocket.csproj | 2 +- test/tools/WebListener/WebListener.csproj | 4 ++-- test/xUnit/xUnit.tests.csproj | 2 +- 25 files changed, 60 insertions(+), 56 deletions(-) diff --git a/DotnetRuntimeMetadata.json b/DotnetRuntimeMetadata.json index fa2b70fd18..464ca8a629 100644 --- a/DotnetRuntimeMetadata.json +++ b/DotnetRuntimeMetadata.json @@ -1,9 +1,9 @@ { "sdk": { - "channel": "8.0.1xx-preview7", + "channel": "8.0.1xx-rc1", "quality": "daily", "qualityFallback": "preview", - "packageVersionPattern": "8.0.0-preview.7", + "packageVersionPattern": "8.0.0-rc.1", "sdkImageVersion": "8.0.100", "nextChannel": "8.0.1xx-preview4", "azureFeed": "", diff --git a/build.psm1 b/build.psm1 index a226bde534..235d9aed3e 100644 --- a/build.psm1 +++ b/build.psm1 @@ -457,6 +457,17 @@ Fix steps: $Arguments += "--self-contained" } + if ($Options.Runtime -like 'win*') { + # Starting in .NET 8, the .NET SDK won't recognize version-specific RIDs by default, such as win7-x64, + # see https://learn.microsoft.com/dotnet/core/compatibility/sdk/8.0/rid-graph for details. + # It will cause huge amount of changes in our build infrastructure because our building and packaging + # scripts have the 'win7-xx' assumption regarding the target runtime. + # + # As a workaround, we use the old full RID graph during the build so that we can continue to use the + # 'win7-x64' and 'win7-x86' RIDs. + $Arguments += "/property:UseRidGraph=true" + } + if ($Options.Runtime -like 'win*' -or ($Options.Runtime -like 'fxdependent*' -and $environment.IsWindows)) { $Arguments += "/property:IsWindows=true" if(!$environment.IsWindows) { @@ -800,6 +811,7 @@ function Restore-PSPackage if ($Options.Runtime -like 'win*') { $RestoreArguments += "/property:EnableWindowsTargeting=True" + $RestoreArguments += "/property:UseRidGraph=True" } if ($InteractiveAuth) { @@ -1197,6 +1209,10 @@ function Publish-PSTestTools { $runtime = $Options.Runtime } + # We are using non-version/distro specific RIDs for test tools, so we need to fix the runtime + # value here if it starts with 'win7'. + $runtime = $runtime -replace '^win7-', 'win-' + Write-Verbose -Verbose -Message "Starting dotnet publish for $toolPath with runtime $runtime" dotnet publish --output bin --configuration $Options.Configuration --framework $Options.Framework --runtime $runtime --self-contained | Out-String | Write-Verbose -Verbose diff --git a/global.json b/global.json index 4ba67068e2..1c036716cc 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.100-preview.7.23376.3" + "version": "8.0.100-rc.1.23455.8" } } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj index e1bc0cf95e..d85cf9797d 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index 500e3e2fbf..a76c7cd3dc 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 7658d48c8f..9e71d3ebd6 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -32,9 +32,9 @@ - - - + + + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index 9d3f8e6cb6..2e0f4153b0 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index f87b369b66..16b011fc4e 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -19,9 +19,9 @@ - - - + + + - + diff --git a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj index 0aee6a78fe..bacaa026f3 100644 --- a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj +++ b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/ResGen/ResGen.csproj b/src/ResGen/ResGen.csproj index 5174826b96..6fc2ebd22b 100644 --- a/src/ResGen/ResGen.csproj +++ b/src/ResGen/ResGen.csproj @@ -7,7 +7,7 @@ Exe true true - win7-x86;win7-x64;osx-x64;linux-x64 + win-x86;win-x64;osx-x64;linux-x64 diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index 281162df4c..b33f4a8c04 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -34,16 +34,16 @@ - - - - + + + + - + - - - + + + diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs index 5222f2f53b..e9eea85d2c 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -8451,8 +8451,7 @@ namespace System.Management.Automation.Language throw PSTraceSource.NewArgumentException(nameof(name)); } - int backtick = name.IndexOf('`'); - if (backtick != -1) + if (name.Contains('`')) { name = name.Replace("``", "`"); } diff --git a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs index 7c32733bb1..c633fd9fe5 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs @@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands /// /// Default shellname. /// - protected const string DefaultPowerShellRemoteShellName = System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix + "Microsoft.PowerShell"; + protected const string DefaultPowerShellRemoteShellName = WSManNativeApi.ResourceURIPrefix + "Microsoft.PowerShell"; /// /// Default application name for the connection uri. @@ -3940,9 +3940,9 @@ namespace Microsoft.PowerShell.Commands string shellUri = null; if (!string.IsNullOrEmpty(configurationName)) { - shellUri = (configurationName.IndexOf( - System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase) != -1) ? - configurationName : System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix + configurationName; + shellUri = configurationName.Contains(WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase) + ? configurationName + : WSManNativeApi.ResourceURIPrefix + configurationName; } foreach (Runspace runspace in runspaces) diff --git a/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs b/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs index 144a9c26b3..acca5fe61b 100644 --- a/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs +++ b/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs @@ -446,9 +446,9 @@ namespace Microsoft.PowerShell.Commands string shellUri = null; if (!string.IsNullOrEmpty(ConfigurationName)) { - shellUri = (ConfigurationName.IndexOf( - System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase) != -1) ? - ConfigurationName : System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix + ConfigurationName; + shellUri = ConfigurationName.Contains(WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase) + ? ConfigurationName + : WSManNativeApi.ResourceURIPrefix + ConfigurationName; } // Connect selected runspace/command and direct command output to host diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 90e3541c28..5704773b73 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -4932,23 +4932,13 @@ namespace Microsoft.PowerShell.Commands // Note: we don't use IO.Path.IsPathRooted as this deals with "invalid" i.e. unnormalized paths private static bool IsAbsolutePath(string path) { - bool result = false; - // check if we're on a single root filesystem and it's an absolute path if (LocationGlobber.IsSingleFileSystemAbsolutePath(path)) { return true; } - // Find the drive separator - int index = path.IndexOf(':'); - - if (index != -1) - { - result = true; - } - - return result; + return path.Contains(':'); } /// diff --git a/src/TypeCatalogGen/TypeCatalogGen.csproj b/src/TypeCatalogGen/TypeCatalogGen.csproj index 2ccfc7f45c..f475ae8334 100644 --- a/src/TypeCatalogGen/TypeCatalogGen.csproj +++ b/src/TypeCatalogGen/TypeCatalogGen.csproj @@ -8,7 +8,7 @@ Exe true true - win7-x86;win7-x64;osx-x64;linux-x64 + win-x86;win-x64;osx-x64;linux-x64 diff --git a/test/hosting/hosting.tests.csproj b/test/hosting/hosting.tests.csproj index 3a73e13931..cb72e0a90e 100644 --- a/test/hosting/hosting.tests.csproj +++ b/test/hosting/hosting.tests.csproj @@ -5,7 +5,6 @@ PowerShell hosting SDK xUnit Tests powershell-hosting-tests - diff --git a/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj b/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj index f9b90d2ada..0956c4122c 100644 --- a/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj +++ b/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj b/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj index 7d9a355baf..0fc8038691 100644 --- a/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj +++ b/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj @@ -9,7 +9,7 @@ - + diff --git a/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj b/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj index 01d397df9e..6dcec1060f 100644 --- a/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj +++ b/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj @@ -15,6 +15,6 @@ - + diff --git a/test/tools/TestExe/TestExe.csproj b/test/tools/TestExe/TestExe.csproj index 8eec2019df..2e9ad01d10 100644 --- a/test/tools/TestExe/TestExe.csproj +++ b/test/tools/TestExe/TestExe.csproj @@ -8,7 +8,7 @@ Exe true true - win7-x86;win7-x64;osx-x64;linux-x64 + win-x86;win-x64;osx-x64;linux-x64 diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index 6db00b25e9..d1298eed38 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -9,11 +9,11 @@ Exe true true - win7-x86;win7-x64 + win-x86;win-x64 - + diff --git a/test/tools/UnixSocket/UnixSocket.csproj b/test/tools/UnixSocket/UnixSocket.csproj index a4143270c8..e8a177bd20 100644 --- a/test/tools/UnixSocket/UnixSocket.csproj +++ b/test/tools/UnixSocket/UnixSocket.csproj @@ -8,7 +8,7 @@ Exe true true - win7-x86;win7-x64;osx-x64;linux-x64 + win-x86;win-x64;osx-x64;linux-x64 diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 8d52ef0275..6068ea71a6 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index 577150aba2..afcd685f5e 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -6,7 +6,7 @@ PowerShell xUnit Tests powershell-tests true - win7-x86;win7-x64;osx-x64;linux-x64 + win-x86;win-x64;osx-x64;linux-x64 From bcfdb27f6a607859392d1b008f65715babbcd9e7 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 12:30:10 -0700 Subject: [PATCH 24/66] [release/v7.4.0-preview.6] Revert changes to continue using `BinaryFormatter` for `Out-GridView` (#20300) (#20360) --- .../FilterRules/ComparableValueFilterRule.cs | 14 +---------- .../FilterRules/DoesNotEqualFilterRule.cs | 15 +---------- .../FilterRules/EqualsFilterRule.cs | 15 +---------- .../FilterCore/FilterRules/FilterRule.cs | 7 +----- .../FilterRules/FilterRuleExtensions.cs | 25 ++++++++++++++++++- .../FilterRules/IsBetweenFilterRule.cs | 16 +----------- .../FilterRules/IsEmptyFilterRule.cs | 13 +--------- .../FilterRules/IsGreaterThanFilterRule.cs | 15 +---------- .../FilterRules/IsLessThanFilterRule.cs | 15 +---------- .../FilterRules/IsNotEmptyFilterRule.cs | 13 +--------- .../FilterRules/IsNotEmptyValidationRule.cs | 1 + .../PropertiesTextContainsFilterRule.cs | 15 +---------- .../PropertyValueSelectorFilterRule.cs | 17 +------------ .../FilterRules/SelectorFilterRule.cs | 18 +------------ .../SingleValueComparableValueFilterRule.cs | 10 +------- .../FilterRules/TextContainsFilterRule.cs | 15 +---------- .../TextDoesNotContainFilterRule.cs | 15 +---------- .../FilterRules/TextDoesNotEqualFilterRule.cs | 15 +---------- .../FilterRules/TextEndsWithFilterRule.cs | 15 +---------- .../FilterRules/TextEqualsFilterRule.cs | 15 +---------- .../FilterCore/FilterRules/TextFilterRule.cs | 12 +-------- .../FilterRules/TextStartsWithFilterRule.cs | 12 +-------- .../FilterCore/ValidatingSelectorValue.cs | 1 + .../FilterCore/ValidatingValue.cs | 1 + .../FilterCore/ValidatingValueBase.cs | 1 + .../DataErrorInfoValidationRule.cs | 1 + .../FilterRuleToDisplayNameConverter.cs | 1 + .../ManagementListStateDescriptor.cs | 1 + .../powershell-win-core.csproj | 1 + 29 files changed, 52 insertions(+), 263 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs index 9e6329e20a..e7ef648e3f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class ComparableValueFilterRule : FilterRule where T : IComparable { #region Properties @@ -61,19 +62,6 @@ namespace Microsoft.Management.UI.Internal return this.Evaluate(castItem); } - /// - /// Creates a clone of the ComparableValueFilterRule instance. - /// - /// - /// Returns a clone of the ComparableValueFilterRule instance. - /// - public override FilterRule Clone() - { - ComparableValueFilterRule rule = (ComparableValueFilterRule)Activator.CreateInstance(this.GetType()); - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item matches a derived classes criteria. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs index d616d9f5ba..ae209d0e60 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class DoesNotEqualFilterRule : EqualsFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the DoesNotEqualFilterRule instance. - /// - /// - /// A clone of the DoesNotEqualFilterRule instance. - /// - public override FilterRule Clone() - { - DoesNotEqualFilterRule rule = new DoesNotEqualFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is not equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs index a8a1762730..7bafd53e41 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class EqualsFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Equals; } - /// - /// Creates a new EqualsFilterRule that is a clone of the current instance. - /// - /// - /// A new EqualsFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - EqualsFilterRule rule = new EqualsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs index b7eec63946..e7717c9a7b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// The base class for all filtering rules. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class FilterRule : IEvaluate { /// @@ -48,12 +49,6 @@ namespace Microsoft.Management.UI.Internal /// Returns true if the item meets the criteria. False otherwise. public abstract bool Evaluate(object item); - /// - /// Creates a clone of this FilterRule. - /// - /// Returns a clone of this FilterRule. - public abstract FilterRule Clone(); - #region EvaluationResultInvalidated /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs index 845d35dd95..bc8e0b02ca 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs @@ -27,7 +27,30 @@ namespace Microsoft.Management.UI.Internal /// public static FilterRule DeepCopy(this FilterRule rule) { - return rule.Clone(); + ArgumentNullException.ThrowIfNull(rule); + +#pragma warning disable SYSLIB0050 + Debug.Assert(rule.GetType().IsSerializable, "rule is serializable"); +#pragma warning disable SYSLIB0011 + BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone)); +#pragma warning restore SYSLIB0011 + MemoryStream ms = new MemoryStream(); + + FilterRule copy = null; + try + { + formatter.Serialize(ms, rule); + + ms.Position = 0; + copy = (FilterRule)formatter.Deserialize(ms); +#pragma warning restore SYSLIB0050 + } + finally + { + ms.Close(); + } + + return copy; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs index 597bafb6db..cbe4a875dd 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsBetweenFilterRule : ComparableValueFilterRule where T : IComparable { #region Properties @@ -50,21 +51,6 @@ namespace Microsoft.Management.UI.Internal protected set; } - /// - /// Creates a clone of the FilterRule. - /// - /// - /// A clone of the FilterRule. - /// - public override FilterRule Clone() - { - IsBetweenFilterRule clone = new IsBetweenFilterRule(); - clone.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - clone.StartValue = this.StartValue; - clone.EndValue = this.EndValue; - return clone; - } - #endregion Properties #region Ctor diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs index d523409e53..5ad2ae1247 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// is empty or not. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsEmptyFilterRule : FilterRule { /// @@ -20,18 +21,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_IsEmpty; } - /// - /// Creates a clone of the IsEmptyFilterRule instance. - /// - /// - /// A clone of IsEmptyFilterRule instance. - /// - public override FilterRule Clone() - { - IsEmptyFilterRule rule = new IsEmptyFilterRule(); - return rule; - } - /// /// Gets a values indicating whether the supplied item is empty. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs index e2cea2d488..d098d2a938 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsGreaterThanFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_GreaterThanOrEqual; } - /// - /// Creates a new IsGreaterThanFilterRule that is a clone of the current instance. - /// - /// - /// A new IsGreaterThanFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - IsGreaterThanFilterRule rule = new IsGreaterThanFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is greater than Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs index 905d14648c..8539d6edf0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsLessThanFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_LessThanOrEqual; } - /// - /// Creates a new IsLessThanFilterRule that is a clone of the current instance. - /// - /// - /// A new IsLessThanFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - IsLessThanFilterRule rule = new IsLessThanFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is less than Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs index b6410917e9..68e501d1f6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// is empty or not. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsNotEmptyFilterRule : IsEmptyFilterRule { /// @@ -20,18 +21,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_IsNotEmpty; } - /// - /// Creates a clone of the IsNotEmptyFilterRule. - /// - /// - /// A clone of the IsNotEmptyFilterRule. - /// - public override FilterRule Clone() - { - IsNotEmptyFilterRule rule = new IsNotEmptyFilterRule(); - return rule; - } - /// /// Gets a values indicating whether the supplied item is not empty. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs index 83734f42f7..31722bfe1f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs @@ -9,6 +9,7 @@ namespace Microsoft.Management.UI.Internal /// The IsNotEmptyValidationRule checks a value to see if a value is not empty. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsNotEmptyValidationRule : DataErrorInfoValidationRule { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs index e1be855825..2a1cc576b3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs @@ -12,6 +12,7 @@ namespace Microsoft.Management.UI.Internal /// Represents a filter rule that searches for text within properties on an object. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class PropertiesTextContainsFilterRule : TextFilterRule { private static readonly string TextContainsCharactersRegexPattern = "{0}"; @@ -37,20 +38,6 @@ namespace Microsoft.Management.UI.Internal private set; } - /// - /// Creates a clone of this . - /// - /// - /// A clone of this . - /// - public override FilterRule Clone() - { - PropertiesTextContainsFilterRule clone = new PropertiesTextContainsFilterRule(); - clone.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - clone.PropertyNames = new List(this.PropertyNames); - return clone; - } - /// /// Evaluates whether the specified properties on contain the current value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 551ae38d45..158ab4e022 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class PropertyValueSelectorFilterRule : SelectorFilterRule where T : IComparable { #region Properties @@ -65,11 +66,6 @@ namespace Microsoft.Management.UI.Internal /// public PropertyValueSelectorFilterRule(string propertyName, string propertyDisplayName, IEnumerable rules) { - ArgumentException.ThrowIfNullOrEmpty(propertyName); - ArgumentException.ThrowIfNullOrEmpty(propertyDisplayName); - - ArgumentNullException.ThrowIfNull(rules); - this.PropertyName = propertyName; this.DisplayName = propertyDisplayName; @@ -120,17 +116,6 @@ namespace Microsoft.Management.UI.Internal return this.AvailableRules.SelectedValue.Evaluate(propertyValue); } - /// - /// Creates a clone of the PropertyValueSelectorFilterRule instance. - /// - /// - /// Returns a clone of the PropertyValueSelectorFilterRule instance. - /// - public override FilterRule Clone() - { - return new PropertyValueSelectorFilterRule(this.PropertyName, this.DisplayName, this.AvailableRules.AvailableValues); - } - #endregion Public Methods #region Private Methods diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs index 6f0042cb48..da4a62b6f6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// The SelectorFilterRule represents a rule composed of other rules. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class SelectorFilterRule : FilterRule { #region Properties @@ -70,23 +71,6 @@ namespace Microsoft.Management.UI.Internal return this.AvailableRules.SelectedValue.Evaluate(item); } - /// - /// Creates a clone of the SelectorFilterRule instance. - /// - /// - /// Returns a clone of the SelectorFilterRule instance. - /// - public override FilterRule Clone() - { - SelectorFilterRule clone = new SelectorFilterRule(); - clone.DisplayName = this.DisplayName; - clone.AvailableRules = this.AvailableRules; - clone.AvailableRules.SelectedValueChanged += clone.AvailableRules_SelectedValueChanged; - clone.AvailableRules.SelectedValue.EvaluationResultInvalidated += clone.SelectedValue_EvaluationResultInvalidated; - - return clone; - } - /// /// Called when the SelectedValue within AvailableRules changes. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs index e716369cb2..9486a12682 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// /// The generic parameter. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class SingleValueComparableValueFilterRule : ComparableValueFilterRule where T : IComparable { #region Properties @@ -53,15 +54,6 @@ namespace Microsoft.Management.UI.Internal #endregion Ctor - /// - /// Creates a clone of the FilterRule. - /// - /// A clone of the FilterRule. - public override FilterRule Clone() - { - return base.Clone(); - } - private void Value_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Value") diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs index db3a6e57e2..fe581ca203 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is contains the rule's value within it. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextContainsFilterRule : TextFilterRule { private static readonly string TextContainsCharactersRegexPattern = "{0}"; @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Contains; } - /// - /// Creates a clone of the TextContainsFilterRule instance. - /// - /// - /// Returns a clone of the TextContainsFilterRule instance. - /// - public override FilterRule Clone() - { - TextContainsFilterRule rule = new TextContainsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if Value is contained within data. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs index e211d4ca8b..29bec9b4bb 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is does not contain the rule's value within it. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextDoesNotContainFilterRule : TextContainsFilterRule { /// @@ -21,20 +22,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the TextDoesNotContainFilterRule instance. - /// - /// - /// A clone of the TextDoesNotContainFilterRule instance. - /// - public override FilterRule Clone() - { - TextDoesNotContainFilterRule rule = new TextDoesNotContainFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if Value is not contained within data. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs index f3a8d5353a..4e72fe16e6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is not equal to the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextDoesNotEqualFilterRule : TextEqualsFilterRule { /// @@ -21,20 +22,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the TextDoesNotEqualFilterRule instance. - /// - /// - /// Returns a clone of the TextDoesNotEqualFilterRule instance. - /// - public override FilterRule Clone() - { - TextDoesNotEqualFilterRule rule = new TextDoesNotEqualFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data is not equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs index b1ef79bc6b..baca67801b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it ends with the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextEndsWithFilterRule : TextFilterRule { private static readonly string TextEndsWithCharactersRegexPattern = "{0}$"; @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_TextEndsWith; } - /// - /// Creates a clone of the TextEndsWithFilterRule instance. - /// - /// - /// Returns a clone of the TextEndsWithFilterRule instance. - /// - public override FilterRule Clone() - { - TextEndsWithFilterRule rule = new TextEndsWithFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data ends with Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs index 5c296dc203..e49dd9b4a0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is equal to the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextEqualsFilterRule : TextFilterRule { private static readonly string TextEqualsCharactersRegexPattern = "^{0}$"; @@ -23,20 +24,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Equals; } - /// - /// Creates a clone of the TextEqualsFilterRule instance. - /// - /// - /// Returns a clone of the TextEqualsFilterRule instance. - /// - public override FilterRule Clone() - { - TextEqualsFilterRule rule = new TextEqualsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data is equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index b2ab66a0db..0dc75cf24e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// evaluating string operations. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class TextFilterRule : SingleValueComparableValueFilterRule { /// @@ -60,17 +61,6 @@ namespace Microsoft.Management.UI.Internal } } - /// - /// Creates a clone of the FilterRule. - /// - /// - /// Returns a clone of the FilterRule. - /// - public override FilterRule Clone() - { - return base.Clone(); - } - /// /// Initializes a new instance of the TextFilterRule class. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs index d04079ee01..e97deb0fd4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it starts with the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextStartsWithFilterRule : TextFilterRule { private static readonly string TextStartsWithCharactersRegexPattern = "^{0}"; @@ -24,17 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_TextStartsWith; } - /// - /// Creates a clone of the TextStartsWithFilterRule instance. - /// - /// - /// Returns a clone of the TextStartsWithFilterRule instance. - /// - public override FilterRule Clone() - { - return base.Clone(); - } - /// /// Determines if data starts with Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index 5f21c186be..f8583e98bc 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -17,6 +17,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ValidatingSelectorValue : ValidatingValueBase { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index 49f1640731..fe21d2fee3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -15,6 +15,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ValidatingValue : ValidatingValueBase { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index 0ead40919d..be7584f0ff 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// classes to support validation via the IDataErrorInfo interface. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class ValidatingValueBase : IDataErrorInfo, INotifyPropertyChanged { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs index 162de593a8..652592aec0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs @@ -9,6 +9,7 @@ namespace Microsoft.Management.UI.Internal /// Provides a way to create a custom rule in order to check the validity of user input. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class DataErrorInfoValidationRule { /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs index 972c19080e..aaca30ff32 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs @@ -12,6 +12,7 @@ namespace Microsoft.Management.UI.Internal /// a FilterRule value to its DisplayName. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class FilterRuleToDisplayNameConverter : IValueConverter { /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index 9798804bd8..45db449d70 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// Allows the state of the ManagementList to be saved and restored. /// [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ManagementListStateDescriptor : StateDescriptor { #region Fields diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 79d9e3fccf..87a8221a68 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -13,6 +13,7 @@ ..\..\assets\pwsh.manifest Windows 8.0 + true From 769a039c43c9bec3d9426e928176e0af76bf669a Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 13:09:39 -0700 Subject: [PATCH 25/66] [release/v7.4.0-preview.6] Update `Microsoft.PowerShell.PSResourceGet` to 0.9.0-rc1 (#20274) (#20361) --- src/Modules/PSGalleryModules.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/PSGalleryModules.csproj b/src/Modules/PSGalleryModules.csproj index f7abd35a6f..a96bac9f64 100644 --- a/src/Modules/PSGalleryModules.csproj +++ b/src/Modules/PSGalleryModules.csproj @@ -13,7 +13,7 @@ - + From a092dad7c09c0b2cc5f37c7bec2701279767e85a Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 13:10:28 -0700 Subject: [PATCH 26/66] [release/v7.4.0-preview.6] Set experimental features to stable for 7.4 release (#20285) (#20362) --- .../common/FormatViewGenerator_Table.cs | 2 +- .../engine/BytePipe.cs | 4 +- .../ExperimentalFeature.cs | 20 ------ .../engine/InitialSessionState.cs | 27 +++----- .../engine/NativeCommandProcessor.cs | 66 +++++++------------ .../engine/pipeline.cs | 33 ++++------ .../engine/runtime/Operations/MiscOps.cs | 22 +++---- .../Basic/NativeCommandBytePiping.Tests.ps1 | 5 -- .../NativeCommandErrorHandling.Tests.ps1 | 6 -- 9 files changed, 55 insertions(+), 130 deletions(-) diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs index 442603b448..64ed5bad6c 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs @@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format ci.alignment = colHeader.alignment; if (colHeader.label != null) { - ci.HeaderMatchesProperty = so.Properties[colHeader.label.text] is not null || !ExperimentalFeature.IsEnabled(ExperimentalFeature.PSCustomTableHeaderLabelDecoration); + ci.HeaderMatchesProperty = so.Properties[colHeader.label.text] is not null; ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(colHeader.label); } diff --git a/src/System.Management.Automation/engine/BytePipe.cs b/src/System.Management.Automation/engine/BytePipe.cs index 3d4832d604..03eb827df9 100644 --- a/src/System.Management.Automation/engine/BytePipe.cs +++ b/src/System.Management.Automation/engine/BytePipe.cs @@ -104,9 +104,7 @@ internal sealed class FileBytePipe : BytePipe throw new RuntimeException(null, e, errorRecord); } - ApplicationInsightsTelemetry.SendExperimentalUseData( - ExperimentalFeature.PSNativeCommandPreserveBytePipe, - "f"); + ApplicationInsightsTelemetry.SendExperimentalUseData("PSNativeCommandPreserveBytePipe", "f"); return new FileBytePipe(fileStream); } diff --git a/src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs b/src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs index 45f8c98e7a..25d9b6e274 100644 --- a/src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs +++ b/src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs @@ -21,14 +21,9 @@ namespace System.Management.Automation #region Const Members internal const string EngineSource = "PSEngine"; - internal const string PSNativeCommandErrorActionPreferenceFeatureName = "PSNativeCommandErrorActionPreference"; - internal const string PSNativeCommandPreserveBytePipe = "PSNativeCommandPreserveBytePipe"; internal const string PSModuleAutoLoadSkipOfflineFilesFeatureName = "PSModuleAutoLoadSkipOfflineFiles"; - internal const string PSCustomTableHeaderLabelDecoration = "PSCustomTableHeaderLabelDecoration"; internal const string PSFeedbackProvider = "PSFeedbackProvider"; internal const string PSCommandWithArgs = "PSCommandWithArgs"; - internal const string PSConstrainedAuditLogging = "PSConstrainedAuditLogging"; - internal const string PSWindowsNativeCommandArgPassing = "PSWindowsNativeCommandArgPassing"; #endregion @@ -120,30 +115,15 @@ namespace System.Management.Automation new ExperimentalFeature( name: "PSLoadAssemblyFromNativeCode", description: "Expose an API to allow assembly loading from native code"), - new ExperimentalFeature( - name: PSNativeCommandErrorActionPreferenceFeatureName, - description: "Native commands with non-zero exit codes issue errors according to $ErrorActionPreference when $PSNativeCommandUseErrorActionPreference is $true"), new ExperimentalFeature( name: PSModuleAutoLoadSkipOfflineFilesFeatureName, description: "Module discovery will skip over files that are marked by cloud providers as not fully on disk."), - new ExperimentalFeature( - name: PSCustomTableHeaderLabelDecoration, - description: "Formatting differentiation for table header labels that aren't property members"), - new ExperimentalFeature( - name: PSNativeCommandPreserveBytePipe, - description: "Byte output is retained when piping between two or more native commands"), new ExperimentalFeature( name: PSFeedbackProvider, description: "Replace the hard-coded suggestion framework with the extensible feedback provider"), new ExperimentalFeature( name: PSCommandWithArgs, description: "Enable `-CommandWithArgs` parameter for pwsh"), - new ExperimentalFeature( - name: PSConstrainedAuditLogging, - description: "PowerShell restriction logging when WDAC (Windows Defender Application Control) Code Integrity policy is set to Audit mode."), - new ExperimentalFeature( - name: "PSWindowsNativeCommandArgPassing", - description: "Enable 'Windows' as the native command argument passing mode"), }; EngineExperimentalFeatures = new ReadOnlyCollection(engineFeatures); diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index d367f4eb10..0a2d3fa74d 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -4652,16 +4652,13 @@ end { #endregion }; - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandErrorActionPreferenceFeatureName)) - { - builtinVariables.Add( - new SessionStateVariableEntry( - SpecialVariables.PSNativeCommandUseErrorActionPreference, - value: true, // when this feature is changed to stable, this should default to `false` - RunspaceInit.PSNativeCommandUseErrorActionPreferenceDescription, - ScopedItemOptions.None, - new ArgumentTypeConverterAttribute(typeof(bool)))); - } + builtinVariables.Add( + new SessionStateVariableEntry( + SpecialVariables.PSNativeCommandUseErrorActionPreference, + value: false, + RunspaceInit.PSNativeCommandUseErrorActionPreferenceDescription, + ScopedItemOptions.None, + new ArgumentTypeConverterAttribute(typeof(bool)))); builtinVariables.Add( new SessionStateVariableEntry( @@ -4677,20 +4674,14 @@ end { /// /// Assigns the default behavior for native argument passing. /// If the system is non-Windows, we will return Standard. - /// If the experimental feature is enabled, we will return Windows. - /// Otherwise, we will return Legacy. + /// Otherwise, we will return Windows. /// private static NativeArgumentPassingStyle GetPassingStyle() { #if UNIX return NativeArgumentPassingStyle.Standard; #else - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSWindowsNativeCommandArgPassing)) - { - return NativeArgumentPassingStyle.Windows; - } - - return NativeArgumentPassingStyle.Legacy; + return NativeArgumentPassingStyle.Windows; #endif } diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index 326e96dfac..85b675a9ae 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -397,8 +397,7 @@ namespace System.Management.Automation { // If upstream is a native command it'll be writing directly to our stdin stream // so we can skip reading here. - if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - || !UpstreamIsNativeCommand) + if (!UpstreamIsNativeCommand) { while (Read()) { @@ -547,7 +546,7 @@ namespace System.Management.Automation // Send Telemetry indicating what argument passing mode we are in. ApplicationInsightsTelemetry.SendExperimentalUseData( - ExperimentalFeature.PSWindowsNativeCommandArgPassing, + "PSWindowsNativeCommandArgPassing", NativeParameterBinderController.ArgumentPassingStyle.ToString()); #if !UNIX @@ -720,9 +719,7 @@ namespace System.Management.Automation lock (_sync) { - if (!_stopped - && (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - || !UpstreamIsNativeCommand)) + if (!_stopped && !UpstreamIsNativeCommand) { _inputWriter.Start(_nativeProcess, inputFormat); } @@ -785,21 +782,16 @@ namespace System.Management.Automation if (CommandRuntime.ErrorMergeTo is MshCommandRuntime.MergeDataStream.Output) { StdOutDestination = null; - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe)) + if (DownStreamNativeCommand is not null) { - if (DownStreamNativeCommand is not null) - { - DownStreamNativeCommand.UpstreamIsNativeCommand = false; - DownStreamNativeCommand = null; - } + DownStreamNativeCommand.UpstreamIsNativeCommand = false; + DownStreamNativeCommand = null; } } _nativeProcessOutputQueue = new BlockingCollection(); // we don't assign the handler to anything, because it's used only for objects marshaling - BytePipe stdOutDestination = ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - ? StdOutDestination ?? DownStreamNativeCommand?.CreateBytePipe(stdout: false) - : null; + BytePipe stdOutDestination = StdOutDestination ?? DownStreamNativeCommand?.CreateBytePipe(stdout: false); BytePipe stdOutSource = null; if (stdOutDestination is not null) @@ -823,8 +815,7 @@ namespace System.Management.Automation { if (blocking) { - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - && _stdOutByteTransfer is not null) + if (_stdOutByteTransfer is not null) { _stdOutByteTransfer.EOF.GetAwaiter().GetResult(); return null; @@ -853,8 +844,7 @@ namespace System.Management.Automation } else { - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - && _stdOutByteTransfer is not null) + if (_stdOutByteTransfer is not null) { return null; } @@ -897,8 +887,7 @@ namespace System.Management.Automation if (!_isRunningInBackground) { // Wait for input writer to finish. - if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - || !UpstreamIsNativeCommand) + if (!UpstreamIsNativeCommand) { _inputWriter.Done(); } @@ -952,12 +941,6 @@ namespace System.Management.Automation this.commandRuntime.PipelineProcessor.ExecutionFailed = true; - // Feature is not enabled, so return - if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandErrorActionPreferenceFeatureName)) - { - return; - } - // We send telemetry information only if the feature is enabled. // This shouldn't be done once, because it's a run-time check we should send telemetry every time. // Report on the following conditions: @@ -973,12 +956,12 @@ namespace System.Management.Automation // The variable is unset if (useDefaultSetting) { - ApplicationInsightsTelemetry.SendExperimentalUseData(ExperimentalFeature.PSNativeCommandErrorActionPreferenceFeatureName, "unset"); + ApplicationInsightsTelemetry.SendExperimentalUseData("PSNativeCommandErrorActionPreference", "unset"); return; } // Send the value that was set. - ApplicationInsightsTelemetry.SendExperimentalUseData(ExperimentalFeature.PSNativeCommandErrorActionPreferenceFeatureName, nativeErrorActionPreferenceSetting.ToString()); + ApplicationInsightsTelemetry.SendExperimentalUseData("PSNativeCommandErrorActionPreference", nativeErrorActionPreferenceSetting.ToString()); // if it was explicitly set to false, return if (!nativeErrorActionPreferenceSetting) @@ -1267,8 +1250,7 @@ namespace System.Management.Automation if (!_runStandAlone) { // Stop input writer - if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - || !UpstreamIsNativeCommand) + if (!UpstreamIsNativeCommand) { _inputWriter.Stop(); } @@ -1816,8 +1798,7 @@ namespace System.Management.Automation return; } - if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - || stdOutDestination is null) + if (stdOutDestination is null) { _isFirstOutput = true; _isXmlCliOutput = false; @@ -2074,19 +2055,16 @@ namespace System.Management.Automation object baseObjInput = PSObject.Base(input); - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe)) + if (baseObjInput is byte[] bytes) { - if (baseObjInput is byte[] bytes) - { - _streamWriter.BaseStream.Write(bytes, 0, bytes.Length); - return; - } + _streamWriter.BaseStream.Write(bytes, 0, bytes.Length); + return; + } - if (baseObjInput is byte b) - { - _streamWriter.BaseStream.WriteByte(b); - return; - } + if (baseObjInput is byte b) + { + _streamWriter.BaseStream.WriteByte(b); + return; } AddTextInput(input); diff --git a/src/System.Management.Automation/engine/pipeline.cs b/src/System.Management.Automation/engine/pipeline.cs index a045a4f83f..e19bf3be84 100644 --- a/src/System.Management.Automation/engine/pipeline.cs +++ b/src/System.Management.Automation/engine/pipeline.cs @@ -261,31 +261,26 @@ namespace System.Management.Automation.Internal /// internal int Add(CommandProcessorBase commandProcessor) { - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe)) + if (commandProcessor is NativeCommandProcessor nativeCommand) { - if (commandProcessor is NativeCommandProcessor nativeCommand) + if (_lastNativeCommand is not null) { - if (_lastNativeCommand is not null) + // Only report experimental feature usage once per pipeline. + if (!_haveReportedNativePipeUsage) { - // Only report experimental feature usage once per pipeline. - if (!_haveReportedNativePipeUsage) - { - ApplicationInsightsTelemetry.SendExperimentalUseData( - ExperimentalFeature.PSNativeCommandPreserveBytePipe, - "p"); - _haveReportedNativePipeUsage = true; - } - - _lastNativeCommand.DownStreamNativeCommand = nativeCommand; - nativeCommand.UpstreamIsNativeCommand = true; + ApplicationInsightsTelemetry.SendExperimentalUseData("PSNativeCommandPreserveBytePipe", "p"); + _haveReportedNativePipeUsage = true; } - _lastNativeCommand = nativeCommand; - } - else - { - _lastNativeCommand = null; + _lastNativeCommand.DownStreamNativeCommand = nativeCommand; + nativeCommand.UpstreamIsNativeCommand = true; } + + _lastNativeCommand = nativeCommand; + } + else + { + _lastNativeCommand = null; } commandProcessor.CommandRuntime.PipelineProcessor = this; diff --git a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs index 583288905c..eb3100ea51 100644 --- a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs +++ b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs @@ -221,10 +221,7 @@ namespace System.Management.Automation bool redirectedInformation = false; if (redirections != null) { - bool shouldProcessMergesFirst = ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - && isNativeCommand; - - if (shouldProcessMergesFirst) + if (isNativeCommand) { foreach (CommandRedirection redirection in redirections) { @@ -237,7 +234,7 @@ namespace System.Management.Automation foreach (CommandRedirection redirection in redirections) { - if (!shouldProcessMergesFirst || redirection is not MergingRedirection) + if (!isNativeCommand || redirection is not MergingRedirection) { redirection.Bind(pipe, commandProcessor, context); } @@ -1081,16 +1078,13 @@ namespace System.Management.Automation // dir > out internal override void Bind(PipelineProcessor pipelineProcessor, CommandProcessorBase commandProcessor, ExecutionContext context) { - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe)) + if (commandProcessor is NativeCommandProcessor nativeCommand + && nativeCommand.CommandRuntime.ErrorMergeTo is not MshCommandRuntime.MergeDataStream.Output + && FromStream is RedirectionStream.Output + && !string.IsNullOrWhiteSpace(File)) { - if (commandProcessor is NativeCommandProcessor nativeCommand - && nativeCommand.CommandRuntime.ErrorMergeTo is not MshCommandRuntime.MergeDataStream.Output - && FromStream is RedirectionStream.Output - && !string.IsNullOrWhiteSpace(File)) - { - nativeCommand.StdOutDestination = FileBytePipe.Create(File, Appending); - return; - } + nativeCommand.StdOutDestination = FileBytePipe.Create(File, Appending); + return; } Pipe pipe = GetRedirectionPipe(context, pipelineProcessor); diff --git a/test/powershell/engine/Basic/NativeCommandBytePiping.Tests.ps1 b/test/powershell/engine/Basic/NativeCommandBytePiping.Tests.ps1 index 1e645df903..236cbd8c9e 100644 --- a/test/powershell/engine/Basic/NativeCommandBytePiping.Tests.ps1 +++ b/test/powershell/engine/Basic/NativeCommandBytePiping.Tests.ps1 @@ -8,11 +8,6 @@ Describe 'Native command byte piping tests' -Tags 'CI' { BeforeAll { $originalDefaultParameterValues = $PSDefaultParameterValues.Clone() - if (-not [ExperimentalFeature]::IsEnabled('PSNativeCommandPreserveBytePipe')) - { - $PSDefaultParameterValues['It:Skip'] = $true - return - } # Without this the test would otherwise be hard coded to a specific set # of [Console]::OutputEncoding/$OutputEncoding settings. diff --git a/test/powershell/engine/Basic/NativeCommandErrorHandling.Tests.ps1 b/test/powershell/engine/Basic/NativeCommandErrorHandling.Tests.ps1 index 055382bb5e..8122e598d2 100644 --- a/test/powershell/engine/Basic/NativeCommandErrorHandling.Tests.ps1 +++ b/test/powershell/engine/Basic/NativeCommandErrorHandling.Tests.ps1 @@ -7,12 +7,6 @@ Describe 'Native command error handling tests' -Tags 'CI' { BeforeAll { $originalDefaultParameterValues = $PSDefaultParameterValues.Clone() - if (-not [ExperimentalFeature]::IsEnabled('PSNativeCommandErrorActionPreference')) - { - $PSDefaultParameterValues['It:Skip'] = $true - return - } - $exeName = $IsWindows ? 'testexe.exe' : 'testexe' $exePath = @(Get-Command $exeName -Type Application)[0].Path From 14f0809164198f030ad40291ac9b201270499f04 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 13:11:34 -0700 Subject: [PATCH 27/66] [release/v7.4.0-preview.6] Bump `XunitXml.TestLogger` from 3.1.11 to 3.1.17 (#20293) (#20364) --- test/xUnit/xUnit.tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index afcd685f5e..8e1b52c7a8 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -26,7 +26,7 @@ - + From 4c096ce7ed7c605a4c0384a5cbd76c14e0bb5b82 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 14:27:03 -0700 Subject: [PATCH 28/66] [release/v7.4.0-preview.6] Update the experimental feature JSON files (#20335) (#20363) --- experimental-feature-linux.json | 7 +------ experimental-feature-windows.json | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/experimental-feature-linux.json b/experimental-feature-linux.json index 4e413efbfc..5adfecd707 100644 --- a/experimental-feature-linux.json +++ b/experimental-feature-linux.json @@ -1,13 +1,8 @@ [ "PSCommandNotFoundSuggestion", "PSCommandWithArgs", - "PSConstrainedAuditLogging", - "PSCustomTableHeaderLabelDecoration", "PSFeedbackProvider", "PSLoadAssemblyFromNativeCode", "PSModuleAutoLoadSkipOfflineFiles", - "PSNativeCommandErrorActionPreference", - "PSNativeCommandPreserveBytePipe", - "PSSubsystemPluginModel", - "PSWindowsNativeCommandArgPassing" + "PSSubsystemPluginModel" ] diff --git a/experimental-feature-windows.json b/experimental-feature-windows.json index 4e413efbfc..5adfecd707 100644 --- a/experimental-feature-windows.json +++ b/experimental-feature-windows.json @@ -1,13 +1,8 @@ [ "PSCommandNotFoundSuggestion", "PSCommandWithArgs", - "PSConstrainedAuditLogging", - "PSCustomTableHeaderLabelDecoration", "PSFeedbackProvider", "PSLoadAssemblyFromNativeCode", "PSModuleAutoLoadSkipOfflineFiles", - "PSNativeCommandErrorActionPreference", - "PSNativeCommandPreserveBytePipe", - "PSSubsystemPluginModel", - "PSWindowsNativeCommandArgPassing" + "PSSubsystemPluginModel" ] From ea80a15890fb5e3f535af49d6c439c0a07f4ecee Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 14:28:03 -0700 Subject: [PATCH 29/66] [release/v7.4.0-preview.6] Fix the release build by moving to the official .NET 8-rc.1 release build version (#20333) (#20365) --- build.psm1 | 12 ++++++------ global.json | 2 +- ...rosoft.PowerShell.Commands.Diagnostics.csproj | 2 +- ...crosoft.PowerShell.Commands.Management.csproj | 2 +- .../Microsoft.PowerShell.Commands.Utility.csproj | 4 ++-- .../Microsoft.PowerShell.CoreCLR.Eventing.csproj | 2 +- .../Microsoft.PowerShell.SDK.csproj | 8 ++++---- .../Microsoft.WSMan.Management.csproj | 2 +- .../System.Management.Automation.csproj | 16 ++++++++-------- .../powershell-win-core.csproj | 2 +- test/tools/TestService/TestService.csproj | 2 +- test/tools/WebListener/WebListener.csproj | 4 ++-- tools/findMissingNotices.ps1 | 4 ++-- tools/packaging/packaging.psm1 | 10 +++++----- .../GenericLinuxFiles/PowerShellPackage.ps1 | 2 +- 15 files changed, 37 insertions(+), 37 deletions(-) diff --git a/build.psm1 b/build.psm1 index 235d9aed3e..27b0e493e4 100644 --- a/build.psm1 +++ b/build.psm1 @@ -273,7 +273,7 @@ function Test-IsReleaseCandidate return $false } -$optimizedFddRegex = 'fxdependent-(linux|alpine|win|win7|osx)-(x64|x86|arm64|arm)' +$optimizedFddRegex = 'fxdependent-(linux|linux-musl|win|win7|osx)-(x64|x86|arm64|arm)' function Start-PSBuild { [CmdletBinding(DefaultParameterSetName="Default")] @@ -307,9 +307,9 @@ function Start-PSBuild { # These runtimes must match those in project.json # We do not use ValidateScript since we want tab completion # If this parameter is not provided it will get determined automatically. - [ValidateSet("alpine-x64", + [ValidateSet("linux-musl-x64", "fxdependent", - "fxdependent-alpine-x64", + "fxdependent-linux-musl-x64", "fxdependent-linux-x64", "fxdependent-linux-arm64", "fxdependent-win-desktop", @@ -898,9 +898,9 @@ function New-PSOptions { # These are duplicated from Start-PSBuild # We do not use ValidateScript since we want tab completion [ValidateSet("", - "alpine-x64", + "linux-musl-x64", "fxdependent", - "fxdependent-alpine-x64", + "fxdependent-linux-musl-x64", "fxdependent-linux-x64", "fxdependent-linux-arm64", "fxdependent-win-desktop", @@ -1346,7 +1346,7 @@ function Start-PSPester { # if we are building for Alpine, we must include the runtime as linux-x64 # will not build runnable test tools if ( $environment.IsLinux -and $environment.IsAlpine ) { - $publishArgs['runtime'] = 'alpine-x64' + $publishArgs['runtime'] = 'linux-musl-x64' } Publish-PSTestTools @publishArgs | ForEach-Object {Write-Host $_} diff --git a/global.json b/global.json index 1c036716cc..adc5611968 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.100-rc.1.23455.8" + "version": "8.0.100-rc.1.23463.5" } } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj index d85cf9797d..e3fc9bd3cf 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index a76c7cd3dc..4952214240 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 9e71d3ebd6..ce30e68eab 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -33,8 +33,8 @@ - - + + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index 2e0f4153b0..5922c52e36 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 16b011fc4e..3082c48bc2 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -19,9 +19,9 @@ - - - + + + - + diff --git a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj index bacaa026f3..4ab85c7959 100644 --- a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj +++ b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index b33f4a8c04..0a11150a78 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -34,16 +34,16 @@ - - - - + + + + - + - - - + + + diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 87a8221a68..73c55497c5 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -8,7 +8,7 @@ true true true - win7-x86;win7-x64 + win-x86;win-x64 Microsoft.PowerShell ..\..\assets\pwsh.manifest Windows diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index d1298eed38..561dac20d1 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 6068ea71a6..89e69a428f 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/tools/findMissingNotices.ps1 b/tools/findMissingNotices.ps1 index 0ea53c665b..e267f718a3 100644 --- a/tools/findMissingNotices.ps1 +++ b/tools/findMissingNotices.ps1 @@ -159,7 +159,7 @@ function Get-CGRegistrations { param( [Parameter(Mandatory)] [ValidateSet( - "alpine-x64", + "linux-musl-x64", "linux-arm", "linux-arm64", "linux-x64", @@ -265,7 +265,7 @@ function Get-CGRegistrations { $registrations = [System.Collections.Generic.Dictionary[string, Registration]]::new() $lastCount = 0 $registrationChanged = $false -foreach ($runtime in "win7-x64", "linux-x64", "osx-x64", "alpine-x64", "win-arm", "linux-arm", "linux-arm64", "osx-arm64", "win-arm64", "win7-x86") { +foreach ($runtime in "win7-x64", "linux-x64", "osx-x64", "linux-musl-x64", "win-arm", "linux-arm", "linux-arm64", "osx-arm64", "win-arm64", "win7-x86") { $registrationChanged = (Get-CGRegistrations -Runtime $runtime -RegistrationTable $registrations) -or $registrationChanged $count = $registrations.Count $newCount = $count - $lastCount diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e860390a38..30148f0d50 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -100,7 +100,7 @@ function Start-PSPackage { } elseif ($MacOSRuntime) { $MacOSRuntime, "Release" } elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-alpine") { - New-PSOptions -Configuration "Release" -Runtime "alpine-x64" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } + New-PSOptions -Configuration "Release" -Runtime "linux-musl-x64" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-arm") { New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-arm64") { @@ -115,7 +115,7 @@ function Start-PSPackage { New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-arm64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-alpine-fxdependent") { - New-PSOptions -Configuration "Release" -Runtime 'fxdependent-alpine-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } + New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-musl-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } else { New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } @@ -594,7 +594,7 @@ function Start-PSPackage { Name = $Name Version = $Version Force = $Force - Architecture = "alpine-x64" + Architecture = "linux-musl-x64" ExcludeSymbolicLinks = $true R2RVerification = [R2RVerification]@{ R2RState = 'R2R' @@ -4513,7 +4513,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { $buildParams.Add("Runtime", "fxdependent") } 'alpine' { - $buildParams.Add("Runtime", 'alpine-x64') + $buildParams.Add("Runtime", 'linux-musl-x64') } } @@ -4606,7 +4606,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { Remove-Item -Path $binDir -Recurse -Force } - $buildParams['Runtime'] = 'fxdependent-alpine-x64' + $buildParams['Runtime'] = 'fxdependent-linux-musl-x64' $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${amd64AlpineFxdBuildFolder}" Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" # Remove symbol files, xml document files. diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index f96263ea6e..ae04aed5ea 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -59,7 +59,7 @@ function BuildPackages { $buildParams.Add("Runtime", "fxdependent") } elseif ($Alpine.IsPresent) { $projectAssetsZipName = 'linuxAlpineProjectAssetssymbols.zip' - $buildParams.Add("Runtime", 'alpine-x64') + $buildParams.Add("Runtime", 'linux-musl-x64') } else { # make the artifact name unique $projectAssetsZipName = "linuxProjectAssets-$((Get-Date).Ticks)-symbols.zip" From bb951753c385d47f82323ac528cfb4808ff800a7 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 15:32:58 -0700 Subject: [PATCH 30/66] [release/v7.4.0-preview.6] Bump `Microsoft.CodeAnalysis.CSharp` from 4.7.0 to 4.8.0-2.final (#20321) (#20368) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- .../PSVersionInfoGenerator/PSVersionInfoGenerator.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index ce30e68eab..6b1e87ae44 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj b/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj index d46e259fb5..4cc9ed7332 100644 --- a/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj +++ b/src/System.Management.Automation/SourceGenerators/PSVersionInfoGenerator/PSVersionInfoGenerator.csproj @@ -13,7 +13,7 @@ - + From b5b6204f10a08e3b6d49d36ff897573ef3888f88 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 Sep 2023 17:17:28 -0700 Subject: [PATCH 31/66] [release/v7.4.0-preview.6] Updates RIDs used to generate component Inventory (#20370) (#20372) Co-authored-by: Travis Plunk --- tools/cgmanifest.json | 16 ++++++++-------- tools/findMissingNotices.ps1 | 9 ++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/cgmanifest.json b/tools/cgmanifest.json index f52550c61c..741ae0cbf5 100644 --- a/tools/cgmanifest.json +++ b/tools/cgmanifest.json @@ -35,7 +35,7 @@ "Type": "nuget", "Nuget": { "Name": "Json.More.Net", - "Version": "1.8.0" + "Version": "1.9.0" } }, "DevelopmentDependency": false @@ -45,7 +45,7 @@ "Type": "nuget", "Nuget": { "Name": "JsonPointer.Net", - "Version": "3.0.1" + "Version": "3.0.3" } }, "DevelopmentDependency": false @@ -55,7 +55,7 @@ "Type": "nuget", "Nuget": { "Name": "JsonSchema.Net", - "Version": "4.1.8" + "Version": "5.2.5" } }, "DevelopmentDependency": false @@ -65,7 +65,7 @@ "Type": "nuget", "Nuget": { "Name": "Markdig.Signed", - "Version": "0.31.0" + "Version": "0.33.0" } }, "DevelopmentDependency": false @@ -105,7 +105,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.CodeAnalysis.Common", - "Version": "4.6.0" + "Version": "4.7.0" } }, "DevelopmentDependency": false @@ -115,7 +115,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.CodeAnalysis.CSharp", - "Version": "4.6.0" + "Version": "4.7.0" } }, "DevelopmentDependency": false @@ -225,7 +225,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Windows.Compatibility", - "Version": "7.0.4" + "Version": "7.0.5" } }, "DevelopmentDependency": false @@ -475,7 +475,7 @@ "Type": "nuget", "Nuget": { "Name": "System.DirectoryServices.AccountManagement", - "Version": "7.0.0" + "Version": "7.0.1" } }, "DevelopmentDependency": false diff --git a/tools/findMissingNotices.ps1 b/tools/findMissingNotices.ps1 index e267f718a3..6e372c0ede 100644 --- a/tools/findMissingNotices.ps1 +++ b/tools/findMissingNotices.ps1 @@ -165,10 +165,9 @@ function Get-CGRegistrations { "linux-x64", "osx-arm64", "osx-x64", - "win-arm", "win-arm64", - "win7-x64", - "win7-x86", + "win-x64", + "win-x86", "modules")] [string]$Runtime, @@ -197,7 +196,7 @@ function Get-CGRegistrations { $folder = $unixProjectName $target = "$dotnetTargetName|$Runtime" } - "win7-.*" { + "win-x*" { $sdkToUse = $winDesktopSdk $folder = $windowsProjectName $target = "$dotnetTargetNameWin7|$Runtime" @@ -265,7 +264,7 @@ function Get-CGRegistrations { $registrations = [System.Collections.Generic.Dictionary[string, Registration]]::new() $lastCount = 0 $registrationChanged = $false -foreach ($runtime in "win7-x64", "linux-x64", "osx-x64", "linux-musl-x64", "win-arm", "linux-arm", "linux-arm64", "osx-arm64", "win-arm64", "win7-x86") { +foreach ($runtime in "win-x64", "linux-x64", "osx-x64", "linux-musl-x64", "linux-arm", "linux-arm64", "osx-arm64", "win-arm64", "win-x86") { $registrationChanged = (Get-CGRegistrations -Runtime $runtime -RegistrationTable $registrations) -or $registrationChanged $count = $registrations.Count $newCount = $count - $lastCount From 86ae2996fb6ae871c3ec0974ac8afd5ff2c6fbee Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 26 Sep 2023 09:23:43 -0700 Subject: [PATCH 32/66] [release/v7.4.0-preview.6] Remove the `ref` folder before running compliance (#20373) (#20375) --- .../azureDevOps/templates/compliance/apiscan.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml index e15a42ff63..730e86fd51 100644 --- a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml +++ b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml @@ -59,6 +59,11 @@ jobs: $OutputFolder = Split-Path (Get-PSOutput) Write-Host "##vso[task.setvariable variable=BinDir]$OutputFolder" + + Write-Verbose -Verbose -Message "Deleting ref folder from output folder" + if (Test-Path $OutputFolder/ref) { + Remove-Item -Recurse -Force $OutputFolder/ref + } workingDirectory: '$(Build.SourcesDirectory)' displayName: 'Build PowerShell Source' From 667e8cc29f8829e2ca688e26c122d0582b50cf41 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 26 Sep 2023 17:15:07 +0000 Subject: [PATCH 33/66] Merged PR 27772: Update ThirdPartyNotices.txt Update ThirdPartyNotices.txt --- ThirdPartyNotices.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 9b173d4463..cfda222696 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -135,7 +135,7 @@ limitations under the License. --------------------------------------------------------- -Markdig.Signed 0.31.0 - BSD-2-Clause +Markdig.Signed 0.33.0 - BSD-2-Clause @@ -172,7 +172,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI --------------------------------------------------------- -Json.More.Net 1.8.0 - MIT +Json.More.Net 1.9.0 - MIT (c) Microsoft 2023 @@ -205,7 +205,7 @@ SOFTWARE. --------------------------------------------------------- -JsonPointer.Net 3.0.1 - MIT +JsonPointer.Net 3.0.3 - MIT (c) Microsoft 2023 @@ -238,7 +238,7 @@ SOFTWARE. --------------------------------------------------------- -JsonSchema.Net 4.1.8 - MIT +JsonSchema.Net 5.2.5 - MIT @@ -343,7 +343,7 @@ SOFTWARE. --------------------------------------------------------- -Microsoft.CodeAnalysis.Common 4.6.0 - MIT +Microsoft.CodeAnalysis.Common 4.7.0 - MIT (c) Microsoft Corporation @@ -363,7 +363,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI --------------------------------------------------------- -Microsoft.CodeAnalysis.CSharp 4.6.0 - MIT +Microsoft.CodeAnalysis.CSharp 4.7.0 - MIT (c) Microsoft Corporation @@ -696,7 +696,7 @@ SOFTWARE. --------------------------------------------------------- -Microsoft.Windows.Compatibility 7.0.4 - MIT +Microsoft.Windows.Compatibility 7.0.5 - MIT (c) Microsoft Corporation @@ -2294,7 +2294,7 @@ SOFTWARE. --------------------------------------------------------- -System.DirectoryServices.AccountManagement 7.0.0 - MIT +System.DirectoryServices.AccountManagement 7.0.1 - MIT (c) Microsoft Corporation From 86e2757c1b54cc9df5a164127854383aaf319cf6 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 27 Sep 2023 17:03:18 +0000 Subject: [PATCH 34/66] Merged PR 27783: Update the regex for package name validation Update the regex for package name validation --- .../azureDevOps/templates/release-ValidatePackageNames.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index 50d75753f1..da3d265a40 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -44,7 +44,7 @@ steps: - pwsh: | $message = @() Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.tar.gz | ForEach-Object { - if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-alpine)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-alpine\-fxdependent)\.(tar\.gz)') + if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-fxdependent)\.(tar\.gz)') { $messageInstance = "$($_.Name) is not a valid package name" $message += $messageInstance From 38d87fe7c2173847ce45a87ff43f69c056169b23 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 27 Sep 2023 19:39:04 +0000 Subject: [PATCH 35/66] Merged PR 27795: Fix the regex for package name validation Fix the regex for package name validation --- .../azureDevOps/templates/release-ValidatePackageNames.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index da3d265a40..a00ac4a857 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -44,7 +44,7 @@ steps: - pwsh: | $message = @() Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.tar.gz | ForEach-Object { - if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-fxdependent)\.(tar\.gz)') + if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-alpine\-fxdependent)\.(tar\.gz)') { $messageInstance = "$($_.Name) is not a valid package name" $message += $messageInstance From 11ae15b093b5c5db92be173b28eac696bc6d8da8 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 27 Sep 2023 23:14:11 +0000 Subject: [PATCH 36/66] Merged PR 27790: Update changelog for v7.4.0-preview.6 release Update changelog for v7.4.0-preview.6 release. Ran `textlint --rule terminology .\CHANGELOG\preview.md` locally and test passed. --- CHANGELOG/preview.md | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/CHANGELOG/preview.md b/CHANGELOG/preview.md index ea1e0efc49..11027a4512 100644 --- a/CHANGELOG/preview.md +++ b/CHANGELOG/preview.md @@ -1,5 +1,64 @@ # Current preview release +## [7.4.0-preview.6] - 2023-09-28 + +### General Cmdlet Updates and Fixes + +- Set approved experimental features to stable for 7.4 release (#20362) +- Revert changes to continue using `BinaryFormatter` for `Out-GridView` (#20360) +- Remove the comment trigger from feedback provider (#20346) + +### Tests + +- Continued improvement to tests for release automation (#20259) +- Skip the test on x86 as `InstallDate` is not visible on `Wow64` (#20255) +- Harden some problematic release tests (#20254) + +### Build and Packaging Improvements + +
+ + + +

Move to .NET 8.0.100-rc.1.23463.5

+ +
+ +
    +
  • Update the regex for package name validation (Internal 27783, 27795)
  • +
  • Update ThirdPartyNotices.txt (Internal 27772)
  • +
  • Remove the ref folder before running compliance (#20375)
  • +
  • Updates RIDs used to generate component Inventory (#20372)
  • +
  • Bump Microsoft.CodeAnalysis.CSharp from 4.7.0 to 4.8.0-2.final (#20368)
  • +
  • Fix the release build by moving to the official .NET 8-rc.1 release build version (#20365)
  • +
  • Update the experimental feature JSON files (#20363)
  • +
  • Bump XunitXml.TestLogger from 3.1.11 to 3.1.17 (#20364)
  • +
  • Update Microsoft.PowerShell.PSResourceGet to 0.9.0-rc1 (#20361)
  • +
  • Update .NET SDK to version 8.0.100-rc.1.23455.8 (#20358)
  • +
  • Use fxdependent-win-desktop runtime for compliance runs (#20359)
  • +
  • Add mapping for mariner arm64 stable (#20348)
  • +
  • Bump xunit.runner.visualstudio from 2.5.0 to 2.5.1 (#20357)
  • +
  • Bump JsonSchema.Net from 5.2.1 to 5.2.5 (#20356)
  • +
  • Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 (#20355)
  • +
  • Bump Markdig.Signed from 0.32.0 to 0.33.0 (#20354)
  • +
  • Bump JsonSchema.Net from 5.1.3 to 5.2.1 (#20353)
  • +
  • Bump actions/checkout from 3 to 4 (#20352)
  • +
  • Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1 (#20351)
  • +
  • Bump Microsoft.CodeAnalysis.CSharp from 4.7.0-2.final to 4.7.0 (#20350)
  • +
  • Release build: Change the names of the PATs (#20349)
  • +
  • Put the calls to Set-AzDoProjectInfo and Set-AzDoAuthToken` in the right order (#20347)
  • +
  • Bump Microsoft.Management.Infrastructure (continued) (#20262)
  • +
  • Bump Microsoft.Management.Infrastructure to 3.0.0-preview.2 (#20261)
  • +
  • Enable vPack provenance data (#20260)
  • +
  • Start using new packages.microsoft.com cli (#20258)
  • +
  • Add mariner arm64 to PMC release (#20257)
  • +
  • Fix typo donet to dotnet in build scripts and pipelines (#20256)
  • +
+ +
+ +[7.4.0-preview.6]: https://github.com/PowerShell/PowerShell/compare/v7.4.0-preview.5...v7.4.0-preview.6 + ## [7.4.0-preview.5] - 2023-08-21 ### Breaking Changes From 53a2edac5342215d231f26c8e0fd76f495bd1d20 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 2 Oct 2023 16:11:26 -0700 Subject: [PATCH 37/66] Add surrogate file for compliance scanning (#20423) --- .../templates/compliance/apiscan.yml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml index 730e86fd51..ea5efe0b22 100644 --- a/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml +++ b/tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml @@ -17,6 +17,8 @@ jobs: - name: branchCounter value: $[counter(variables['branchCounterKey'], 1)] - group: DotNetPrivateBuildAccess + - group: Azure Blob variable group + - group: ReleasePipelineSecrets pool: name: PowerShell1ES @@ -52,6 +54,29 @@ jobs: displayName: Install dotnet-symbol retryCountOnTaskFailure: 2 + - pwsh: | + Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + Install-AzCopy + displayName: Install AzCopy + retryCountOnTaskFailure: 2 + + - pwsh: | + Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + $azcopy = Find-AzCopy + Write-Verbose -Verbose "Found AzCopy: $azcopy" + + $winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/winverify-symbols' -Force + Write-Host "##vso[task.setvariable variable=winverifySymbolsPath]$winverifySymbolsPath" + + & $azcopy cp https://$(StorageAccount).blob.core.windows.net/winverify-private $winverifySymbolsPath --recursive + + Get-ChildItem $winverifySymbolsPath -Recurse | Out-String | Write-Verbose -Verbose + + displayName: Download winverify-private Artifacts + retryCountOnTaskFailure: 2 + env: + AZCOPY_AUTO_LOGIN_TYPE: MSI + - pwsh: | Import-Module .\build.psm1 -force Find-DotNet @@ -64,6 +89,39 @@ jobs: if (Test-Path $OutputFolder/ref) { Remove-Item -Recurse -Force $OutputFolder/ref } + + $surrogateFileTemplate = @' + + + + + + + + {path_to_symbol} + + + + + + + + + + + '@ + + $pathToDll = Get-ChildItem -Path $OutputFolder -Filter 'getfilesiginforedist.dll' -Recurse | Where-Object { $_.fullname -like '*win-x64*' } | Select-Object -First 1 -ExpandProperty FullName + + $surrogateFile = Join-Path $(Pipeline.Workspace) 'APIScanSurrogates.xml' + $surrogateFileContent = $surrogateFileTemplate -replace '{path_to_symbol}', '$(winverifySymbolsPath)\winverify-private' -replace '{path_to_dll}', '$(winverifySymbolsPath)\winverify-private\getfilesiginforedist.dll' -replace '{path_to_dll_in_build}', $pathToDll + $surrogateFileContent | Out-File -FilePath $surrogateFile -Force + + Write-Verbose -Verbose -Message "Surrogate file content:" + Get-Content -Path $surrogateFile -Raw | Out-String | Write-Verbose -Verbose + + Write-Host "##vso[task.setvariable variable=surrogateFilePath]$(Pipeline.Workspace)" + workingDirectory: '$(Build.SourcesDirectory)' displayName: 'Build PowerShell Source' @@ -117,6 +175,7 @@ jobs: verbosityLevel: standard # write a status update every 5 minutes. Default is 1 minute statusUpdateInterval: '00:05:00' + surrogateConfigurationFolder : $(surrogateFilePath) env: AzureServicesAuthConnectionString: RunAs=App;AppId=$(APIScanClient);TenantId=$(APIScanTenant);AppKey=$(APIScanSecret) From e6ee40c7e89782bf9a47ed5c4fec12725e24bfef Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:33:54 -0700 Subject: [PATCH 38/66] Block any preview vPack release (#20243) (#20526) --- tools/releaseBuild/azureDevOps/vpackRelease.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/releaseBuild/azureDevOps/vpackRelease.yml b/tools/releaseBuild/azureDevOps/vpackRelease.yml index e9d1fb286c..14368ffb8f 100644 --- a/tools/releaseBuild/azureDevOps/vpackRelease.yml +++ b/tools/releaseBuild/azureDevOps/vpackRelease.yml @@ -45,6 +45,12 @@ stages: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes UseJson: no + + - powershell: | + if($env:RELEASETAGVAR -match '-') { + throw "Don't release a preview build without coordinating with Windows Engineering Build Tools Team" + } + displayName: Stop any preview release - powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))" displayName: Set Build Name for Non-PR From 62699bd4c5244e7745d6498a84bfe2bfd6d57360 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:34:34 -0700 Subject: [PATCH 39/66] Fixing regression in DSC (#20268) (#20528) --- src/System.Management.Automation/engine/Utils.cs | 1 + src/System.Management.Automation/resources/ParserStrings.resx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 46cc6312b5..e31cf2f81a 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -1424,6 +1424,7 @@ namespace System.Management.Automation internal static class Separators { + internal static readonly char[] Backslash = new char[] { '\\' }; internal static readonly char[] Directory = new char[] { '\\', '/' }; internal static readonly char[] DirectoryOrDrive = new char[] { '\\', '/', ':' }; internal static readonly char[] SpaceOrTab = new char[] { ' ', '\t' }; diff --git a/src/System.Management.Automation/resources/ParserStrings.resx b/src/System.Management.Automation/resources/ParserStrings.resx index f59f742899..5631525cac 100644 --- a/src/System.Management.Automation/resources/ParserStrings.resx +++ b/src/System.Management.Automation/resources/ParserStrings.resx @@ -1304,6 +1304,9 @@ ModuleVersion : Version of module to import. If used, ModuleName must represent Conflict in using PsDscRunAsCredential for Resource {0} because it already specifies PsDscRunAsCredential value. We can only use one PsDscRunAsCredential for the composite resource. + + Unable to find DSC schema store at "{0}". Please ensure PSDesiredStateConfiguration v3 module is installed. + {0} From b49de754e37a7fffa6c6ea6ff1164786dd2bd05c Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:35:09 -0700 Subject: [PATCH 40/66] Fix `Get-Service` non-terminating error message to include category (#20276) (#20529) --- .../commands/management/Service.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index 1d007e6dac..7f35e88a85 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands string message = StringUtil.Format(errorMessage, serviceName, displayName, - (innerException == null) ? string.Empty : innerException.Message); + (innerException == null) ? category.ToString() : innerException.Message); var exception = new ServiceCommandException(message, innerException); exception.ServiceName = serviceName; From dd1fe759d42798b2f9baa82f2eb672d12d6c7d16 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:35:40 -0700 Subject: [PATCH 41/66] Fix implicit remoting proxy cmdlets to act on common parameters (#20367) (#20530) --- .../commands/utility/ImplicitRemotingCommands.cs | 14 ++++++++++++-- .../CompatiblePSEditions.Module.Tests.ps1 | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs index 1631bb1876..f92aa919c4 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs @@ -1300,13 +1300,23 @@ namespace Microsoft.PowerShell.Commands parameterType); } - private static bool IsProxyForCmdlet(Dictionary parameters) + private bool IsProxyForCmdlet(Dictionary parameters) { // we are not sending CmdletBinding/DefaultParameterSet over the wire anymore // we need to infer IsProxyForCmdlet from presence of all common parameters - foreach (string commonParameterName in Cmdlet.CommonParameters) + // need to exclude `ProgressAction` which may not exist for downlevel platforms + bool isDownLevelRemote = Session.Runspace is RemoteRunspace remoteRunspace + && remoteRunspace.ServerVersion is not null + && remoteRunspace.ServerVersion <= new Version(7, 3); + + foreach (string commonParameterName in CommonParameters) { + if (isDownLevelRemote && commonParameterName == "ProgressAction") + { + continue; + } + if (!parameters.ContainsKey(commonParameterName)) { return false; diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 index a9c9b69b20..d4423b034b 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 @@ -1532,4 +1532,15 @@ Describe "WinCompat importing should check availablity of built-in modules" -Tag $result[4] | Should -BeExactly 'ConvertFrom-String' $result[5] | Should -BeExactly 'CFS' } + + It 'ErrorAction should be used for cmdlet' { + try { + $out = Invoke-Expression 'get-AppLockerFileInformation NoSuch.exe -ErrorAction Stop; "after"' + } + catch { + # do nothing as we expect an error, but execution should not continue + } + + $out | Should -Not -Contain 'after' + } } From 3039e2db123a53c3ad2291091bac3abeb922365f Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:36:43 -0700 Subject: [PATCH 42/66] Increase timeout when publishing packages to `packages.microsoft.com` (#20470) (#20539) Co-authored-by: Travis Plunk --- tools/releaseBuild/azureDevOps/releasePipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index b893a8f5cf..3e79785de4 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -341,6 +341,7 @@ stages: - stage: PublishPackages displayName: Publish packages dependsOn: GitHubManualTasks + timeoutInMinutes: 120 jobs: - job: PublishNuget @@ -356,6 +357,7 @@ stages: - job: PublishPkgsMsftCom + timeoutInMinutes: 120 pool: name: PowerShell1ES demands: From 41a1d34823f8221450bf987a709f0c71f6bee004 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:40:07 -0700 Subject: [PATCH 43/66] Bump Microsoft.Management.Infrastructure (#20433) (#20534) --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index 0a11150a78..2d45cea0f7 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -45,7 +45,7 @@ - + From 58d1b6f8f21bbdfe0ee59c9253a38260634184d6 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:40:56 -0700 Subject: [PATCH 44/66] Bump Microsoft.Management.Infrastructure (#20434) (#20535) --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj index ea8692d141..135b0fcba3 100644 --- a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj +++ b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj @@ -8,7 +8,7 @@ 11.0 - + From bdf1cfd2b17bcbb4d2b58231939670eed0564650 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:41:28 -0700 Subject: [PATCH 45/66] Fix UNC path completion regression (#20419) (#20541) --- .../CommandCompletion/CompletionCompleters.cs | 21 ++++++++----------- .../TabCompletion/TabCompletion.Tests.ps1 | 5 +++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index e222075060..357ce126ab 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -4629,22 +4629,19 @@ namespace System.Management.Automation string basePath; if (!relativePaths) { - string providerName = $"{provider.ModuleName}\\{provider.Name}::"; - if (pathInfo.Path.StartsWith(providerName, StringComparison.OrdinalIgnoreCase)) + if (pathInfo.Drive is null) { - basePath = pathInfo.Path.Substring(providerName.Length); + basePath = dirInfo.FullName; } else { - providerName = $"{provider.Name}::"; - if (pathInfo.Path.StartsWith(providerName, StringComparison.OrdinalIgnoreCase)) - { - basePath = pathInfo.Path.Substring(providerName.Length); - } - else - { - basePath = pathInfo.Path; - } + int stringStartIndex = pathInfo.Drive.Root.EndsWith(provider.ItemSeparator) && pathInfo.Drive.Root.Length > 1 + ? pathInfo.Drive.Root.Length - 1 + : pathInfo.Drive.Root.Length; + + basePath = pathInfo.Drive.VolumeSeparatedByColon + ? string.Concat(pathInfo.Drive.Name, ":", dirInfo.FullName.AsSpan(stringStartIndex)) + : string.Concat(pathInfo.Drive.Name, dirInfo.FullName.AsSpan(stringStartIndex)); } basePath = basePath.EndsWith(provider.ItemSeparator) diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index 800e15ad84..613e673cee 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -1276,6 +1276,11 @@ class InheritedClassTest : System.Attribute } } + It 'Should correct slashes in UNC path completion' -Skip:(!$IsWindows) { + $Res = TabExpansion2 -inputScript 'Get-ChildItem //localhost/c$/Windows' + $Res.CompletionMatches[0].CompletionText | Should -Be "'\\localhost\c$\Windows'" + } + It 'Should keep custom drive names when completing file paths' { $TempDriveName = "asdf" $null = New-PSDrive -Name $TempDriveName -PSProvider FileSystem -Root $HOME From e60125d3201b6748cb187fa4434d081b9c0b57cb Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:42:59 -0700 Subject: [PATCH 46/66] Fix alpine tar package name and do not crossgen alpine fxdependent package (#20459) (#20536) --- build.psm1 | 8 ++++---- tools/packaging/packaging.psm1 | 10 +++++----- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 2 +- tools/releaseBuild/azureDevOps/templates/nuget.yml | 2 +- .../templates/release-ValidatePackageNames.yml | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build.psm1 b/build.psm1 index 27b0e493e4..ec95e071bf 100644 --- a/build.psm1 +++ b/build.psm1 @@ -273,7 +273,7 @@ function Test-IsReleaseCandidate return $false } -$optimizedFddRegex = 'fxdependent-(linux|linux-musl|win|win7|osx)-(x64|x86|arm64|arm)' +$optimizedFddRegex = 'fxdependent-(linux|win|win7|osx)-(x64|x86|arm64|arm)' function Start-PSBuild { [CmdletBinding(DefaultParameterSetName="Default")] @@ -309,7 +309,7 @@ function Start-PSBuild { # If this parameter is not provided it will get determined automatically. [ValidateSet("linux-musl-x64", "fxdependent", - "fxdependent-linux-musl-x64", + "fxdependent-noopt-linux-musl-x64", "fxdependent-linux-x64", "fxdependent-linux-arm64", "fxdependent-win-desktop", @@ -563,7 +563,7 @@ Fix steps: Write-Verbose "Building with shim" -Verbose $globalToolSrcFolder = Resolve-Path (Join-Path $Options.Top "../Microsoft.PowerShell.GlobalTool.Shim") | Select-Object -ExpandProperty Path - if ($Options.Runtime -eq 'fxdependent') { + if ($Options.Runtime -eq 'fxdependent' -or $Options.Runtime -eq 'fxdependent-noopt-linux-musl-x64') { $Arguments += "/property:SDKToUse=Microsoft.NET.Sdk" } elseif ($Options.Runtime -eq 'fxdependent-win-desktop') { $Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop" @@ -900,7 +900,7 @@ function New-PSOptions { [ValidateSet("", "linux-musl-x64", "fxdependent", - "fxdependent-linux-musl-x64", + "fxdependent-noopt-linux-musl-x64", "fxdependent-linux-x64", "fxdependent-linux-arm64", "fxdependent-win-desktop", diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 30148f0d50..a657508809 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -115,7 +115,7 @@ function Start-PSPackage { New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-arm64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-alpine-fxdependent") { - New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-musl-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } + New-PSOptions -Configuration "Release" -Runtime 'fxdependent-noopt-linux-musl-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } else { New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } @@ -456,11 +456,11 @@ function Start-PSPackage { $Arguments = @{ PackageSourcePath = $Source Name = $Name - PackageNameSuffix = 'alpine-fxdependent' + PackageNameSuffix = 'musl-noopt-fxdependent' Version = $Version Force = $Force R2RVerification = [R2RVerification]@{ - R2RState = 'R2R' + R2RState = 'NoR2R' OperatingSystem = "Linux" } } @@ -594,7 +594,7 @@ function Start-PSPackage { Name = $Name Version = $Version Force = $Force - Architecture = "linux-musl-x64" + Architecture = "musl-x64" ExcludeSymbolicLinks = $true R2RVerification = [R2RVerification]@{ R2RState = 'R2R' @@ -4606,7 +4606,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { Remove-Item -Path $binDir -Recurse -Force } - $buildParams['Runtime'] = 'fxdependent-linux-musl-x64' + $buildParams['Runtime'] = 'fxdependent-noopt-linux-musl-x64' $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${amd64AlpineFxdBuildFolder}" Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" # Remove symbol files, xml document files. diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index ae04aed5ea..2475dce7d8 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -59,7 +59,7 @@ function BuildPackages { $buildParams.Add("Runtime", "fxdependent") } elseif ($Alpine.IsPresent) { $projectAssetsZipName = 'linuxAlpineProjectAssetssymbols.zip' - $buildParams.Add("Runtime", 'linux-musl-x64') + $buildParams.Add("Runtime", 'musl-x64') } else { # make the artifact name unique $projectAssetsZipName = "linuxProjectAssets-$((Get-Date).Ticks)-symbols.zip" diff --git a/tools/releaseBuild/azureDevOps/templates/nuget.yml b/tools/releaseBuild/azureDevOps/templates/nuget.yml index 749956682d..247e91013a 100644 --- a/tools/releaseBuild/azureDevOps/templates/nuget.yml +++ b/tools/releaseBuild/azureDevOps/templates/nuget.yml @@ -111,7 +111,7 @@ jobs: - task: ExtractFiles@1 displayName: 'Extract files alpine-fxdependent' inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-x64-alpine-fxdependent.tar.gz' + archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-x64-musl-noopt-fxdependent.tar.gz' destinationFolder: '$(alpineFxdPath)' - template: SetVersionVariables.yml diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index a00ac4a857..1fb5364302 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -44,7 +44,7 @@ steps: - pwsh: | $message = @() Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.tar.gz | ForEach-Object { - if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-alpine\-fxdependent)\.(tar\.gz)') + if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl\-fxdependent)\.(tar\.gz)') { $messageInstance = "$($_.Name) is not a valid package name" $message += $messageInstance From 5c1ca0f3f6accc7ff303641bf83d580dcf44d19b Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:43:22 -0700 Subject: [PATCH 47/66] Fix `unixmode` to handle `setuid` and `sticky` when file is not an executable (#20366) (#20537) --- .../CoreCLR/CorePsPlatform.cs | 113 ++++++++---------- .../UnixStat.Tests.ps1 | 15 ++- 2 files changed, 63 insertions(+), 65 deletions(-) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 783afe6291..dc5db5f2c4 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -594,82 +594,69 @@ namespace System.Management.Automation private const char CanRead = 'r'; private const char CanWrite = 'w'; private const char CanExecute = 'x'; - - // helper for getting unix mode - private readonly Dictionary modeMap = new() - { - { StatMask.OwnerRead, CanRead }, - { StatMask.OwnerWrite, CanWrite }, - { StatMask.OwnerExecute, CanExecute }, - { StatMask.GroupRead, CanRead }, - { StatMask.GroupWrite, CanWrite }, - { StatMask.GroupExecute, CanExecute }, - { StatMask.OtherRead, CanRead }, - { StatMask.OtherWrite, CanWrite }, - { StatMask.OtherExecute, CanExecute }, - }; - - private readonly StatMask[] permissions = new StatMask[] - { - StatMask.OwnerRead, - StatMask.OwnerWrite, - StatMask.OwnerExecute, - StatMask.GroupRead, - StatMask.GroupWrite, - StatMask.GroupExecute, - StatMask.OtherRead, - StatMask.OtherWrite, - StatMask.OtherExecute - }; + private const char NoPerm = '-'; + private const char SetAndExec = 's'; + private const char SetAndNotExec = 'S'; + private const char StickyAndExec = 't'; + private const char StickyAndNotExec = 'T'; // The item type and the character representation for the first element in the stat string - private readonly Dictionary itemTypeTable = new() + private static readonly Dictionary itemTypeTable = new() { - { ItemType.BlockDevice, 'b' }, + { ItemType.BlockDevice, 'b' }, { ItemType.CharacterDevice, 'c' }, - { ItemType.Directory, 'd' }, - { ItemType.File, '-' }, - { ItemType.NamedPipe, 'p' }, - { ItemType.Socket, 's' }, - { ItemType.SymbolicLink, 'l' }, + { ItemType.Directory, 'd' }, + { ItemType.File, '-' }, + { ItemType.NamedPipe, 'p' }, + { ItemType.Socket, 's' }, + { ItemType.SymbolicLink, 'l' }, }; + // We'll create a few common mode strings here to reduce allocations and improve performance a bit. + private const string OwnerReadGroupReadOtherRead = "-r--r--r--"; + private const string OwnerReadWriteGroupReadOtherRead = "-rw-r--r--"; + private const string DirectoryOwnerFullGroupReadExecOtherReadExec = "drwxr-xr-x"; + /// Convert the mode to a string which is usable in our formatting. /// The mode converted into a Unix style string similar to the output of ls. public string GetModeString() { - int offset = 0; - char[] modeCharacters = new char[10]; - modeCharacters[offset++] = itemTypeTable[ItemType]; - - foreach (StatMask permission in permissions) + // On an Ubuntu system (docker), these 3 are roughly 70% of all the permissions + if ((Mode & 0xFFF) == 292) { - // determine whether we are setuid, sticky, or the usual rwx. - if ((Mode & (int)permission) == (int)permission) - { - if ((permission == StatMask.OwnerExecute && IsSetUid) || (permission == StatMask.GroupExecute && IsSetGid)) - { - // Check for setuid and add 's' - modeCharacters[offset] = 's'; - } - else if (permission == StatMask.OtherExecute && IsSticky && (ItemType == ItemType.Directory)) - { - // Directories are sticky, rather than setuid - modeCharacters[offset] = 't'; - } - else - { - modeCharacters[offset] = modeMap[permission]; - } - } - else - { - modeCharacters[offset] = '-'; - } - - offset++; + return OwnerReadGroupReadOtherRead; } + if ((Mode & 0xFFF) == 420) + { + return OwnerReadWriteGroupReadOtherRead; + } + + if (ItemType == ItemType.Directory & (Mode & 0xFFF) == 493) + { + return DirectoryOwnerFullGroupReadExecOtherReadExec; + } + + Span modeCharacters = stackalloc char[10]; + modeCharacters[0] = itemTypeTable[ItemType]; + bool isExecutable; + + UnixFileMode modeInfo = (UnixFileMode)Mode; + modeCharacters[1] = modeInfo.HasFlag(UnixFileMode.UserRead) ? CanRead : NoPerm; + modeCharacters[2] = modeInfo.HasFlag(UnixFileMode.UserWrite) ? CanWrite : NoPerm; + isExecutable = modeInfo.HasFlag(UnixFileMode.UserExecute); + modeCharacters[3] = modeInfo.HasFlag(UnixFileMode.SetUser) ? (isExecutable ? SetAndExec : SetAndNotExec) : (isExecutable ? CanExecute : NoPerm); + + modeCharacters[4] = modeInfo.HasFlag(UnixFileMode.GroupRead) ? CanRead : NoPerm; + modeCharacters[5] = modeInfo.HasFlag(UnixFileMode.GroupWrite) ? CanWrite : NoPerm; + isExecutable = modeInfo.HasFlag(UnixFileMode.GroupExecute); + modeCharacters[6] = modeInfo.HasFlag(UnixFileMode.SetGroup) ? (isExecutable ? SetAndExec : SetAndNotExec) : (isExecutable ? CanExecute : NoPerm); + + modeCharacters[7] = modeInfo.HasFlag(UnixFileMode.OtherRead) ? CanRead : NoPerm; + modeCharacters[8] = modeInfo.HasFlag(UnixFileMode.OtherWrite) ? CanWrite : NoPerm; + isExecutable = modeInfo.HasFlag(UnixFileMode.OtherExecute); + modeCharacters[9] = modeInfo.HasFlag(UnixFileMode.StickyBit) ? (isExecutable ? StickyAndExec : StickyAndNotExec) : (isExecutable ? CanExecute : NoPerm); + return new string(modeCharacters); } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/UnixStat.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/UnixStat.Tests.ps1 index b14df30e7e..fcefb707a2 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/UnixStat.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/UnixStat.Tests.ps1 @@ -37,6 +37,10 @@ Describe "UnixFileSystem additions" -Tag "CI" { @{ Mode = '555'; Perm = '-r-xr-xr-x'; Item = "${testFile}" }, @{ Mode = '666'; Perm = '-rw-rw-rw-'; Item = "${testFile}" }, @{ Mode = '777'; Perm = '-rwxrwxrwx'; Item = "${testFile}" }, + @{ Mode = '4644'; Perm = '-rwSr--r--'; Item = "${testFile}" }, + @{ Mode = '1644'; Perm = '-rw-r--r-T'; Item = "${testFile}" }, + @{ Mode = '2644'; Perm = '-rw-r-Sr--'; Item = "${testFile}" }, + @{ Mode = '7644'; Perm = '-rwSr-Sr-T'; Item = "${testFile}" }, @{ Mode = '4777'; Perm = '-rwsrwxrwx'; Item = "${testFile}" }, @{ Mode = '1777'; Perm = 'drwxrwxrwt'; Item = "${testDir}" } } @@ -57,9 +61,16 @@ Describe "UnixFileSystem additions" -Tag "CI" { It "Should present filemode '' string correctly as ''" -testCase $testCase { param ($Mode, $Perm, $Item ) + # chmod can fail for some modes so be sure to handle that here. + # specifically, when setting setgid chmod can fail if the group is privileged. chmod "$Mode" "${Item}" - $i = Get-Item $Item - $i.UnixMode | Should -Be $Perm + if ($LASTEXITCODE -ne 0) { + set-itresult -skip -because "chmod '$mode' failed" + } + else { + $i = Get-Item $Item + $i.UnixMode | Should -BeExactly $Perm + } } It "Should retrieve the user name for the file" { From 3c6c8cf43b99cf48dde0f8b202a6c418d55a8ac8 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:52:51 -0700 Subject: [PATCH 48/66] Bump JsonSchema.Net from 5.2.5 to 5.2.6 (#20421) (#20532) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 6b1e87ae44..f7410061a6 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -35,7 +35,7 @@ - +
From 178df6cae6875b3c56b76276e401958926f2a565 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:58:38 -0700 Subject: [PATCH 49/66] Bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 (#20486) (#20542) --- test/xUnit/xUnit.tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index 8e1b52c7a8..a5ecd4e529 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -25,7 +25,7 @@ - + From 3ea6496813c90b6eedd05d587cf5327fd2b0eba1 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 14:59:25 -0700 Subject: [PATCH 50/66] Bump version of `Microsoft.PowerShell.PSResourceGet` to `v1.0.0` (#20485) (#20538) Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com> --- src/Modules/PSGalleryModules.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/PSGalleryModules.csproj b/src/Modules/PSGalleryModules.csproj index a96bac9f64..f4d5d37475 100644 --- a/src/Modules/PSGalleryModules.csproj +++ b/src/Modules/PSGalleryModules.csproj @@ -13,7 +13,7 @@ - + From 9e8a5cc033f83627d5f91a74d4bd2aee6b2f82f0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 15:03:42 -0700 Subject: [PATCH 51/66] Fix `Copy-Item` progress to only show completed when all files are copied (#20517) (#20544) --- .../namespaces/FileSystemProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 5704773b73..7236a6f389 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -3569,7 +3569,7 @@ namespace Microsoft.PowerShell.Commands } CopyItemLocalOrToSession(path, destinationPath, recurse, Force, null); - if (_totalFiles > 0) + if (Stopping || _copiedFiles == _totalFiles) { _copyStopwatch.Stop(); var progress = new ProgressRecord(COPY_FILE_ACTIVITY_ID, " ", " "); From dd56ad65ad33b953d0fb05580c3834ec3a523aa2 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 15:21:42 -0700 Subject: [PATCH 52/66] Add SBOM for release pipeline (#20519) (#20548) --- .../azureDevOps/releasePipeline.yml | 7 ++++- .../templates/release-CreateGitHubDraft.yml | 27 +++++++++++++++---- .../release-ValidatePackageNames.yml | 4 +-- .../azureDevOps/templates/vpackReleaseJob.yml | 4 +-- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index 3e79785de4..b406dd0b73 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -29,6 +29,12 @@ resources: name: Internal-PowerShellTeam-Tools ref: main-mirror + - repository: ComplianceRepo + type: github + endpoint: ComplianceGHRepo + name: PowerShell/compliance + ref: master + variables: - name: runCodesignValidationInjection value : false @@ -341,7 +347,6 @@ stages: - stage: PublishPackages displayName: Publish packages dependsOn: GitHubManualTasks - timeoutInMinutes: 120 jobs: - job: PublishNuget diff --git a/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml b/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml index dc7cf12663..64c4d1b6a2 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml @@ -7,17 +7,16 @@ steps: - template: release-SetReleaseTagAndContainerName.yml - pwsh: | - Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + Import-module '$(BUILD.SOURCESDIRECTORY)/PowerShell/build.psm1' Install-AzCopy displayName: Install AzCopy retryCountOnTaskFailure: 2 - pwsh: | - Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + Import-module '$(BUILD.SOURCESDIRECTORY)/PowerShell/build.psm1' $azcopy = Find-AzCopy Write-Verbose -Verbose "Found AzCopy: $azcopy" - & $azcopy login --service-principal --application-id $(PowerShellReleaseSPN) & $azcopy cp https://$(StorageAccount).blob.core.windows.net/$(AzureVersion) $(System.ArtifactsDirectory) --recursive $packagesPath = Get-ChildItem -Path $(System.ArtifactsDirectory)\*.deb -Recurse -File | Select-Object -First 1 -ExpandProperty DirectoryName @@ -27,7 +26,7 @@ steps: displayName: Download Azure Artifacts retryCountOnTaskFailure: 2 env: - AZCOPY_SPA_CLIENT_SECRET: $(PowerShellReleaseSPNSecret) + AZCOPY_AUTO_LOGIN_TYPE: MSI - pwsh: | Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty FullName @@ -55,6 +54,24 @@ steps: Write-Verbose -Verbose -Message $fileContent displayName: Add sha256 hashes +- checkout: ComplianceRepo + +- pwsh: | + $releaseVersion = '$(ReleaseTag)' -replace '^v','' + $vstsCommandString = "vso[task.setvariable variable=ReleaseVersion]$releaseVersion" + Write-Host "sending " + $vstsCommandString + Write-Host "##$vstsCommandString" + displayName: 'Set release version' + +- template: Sbom.yml@ComplianceRepo + parameters: + BuildDropPath: '$(PackagesRoot)' + Build_Repository_Uri: 'https://github.com/powershell/powershell.git' + displayName: PowerShell Hashes SBOM + packageName: PowerShell Artifact Hashes + packageVersion: $(ReleaseVersion) + sourceScanPath: '$(PackagesRoot)' + - pwsh: | Import-module '$(Pipeline.Workspace)/tools/Scripts/GitHubRelease.psm1' $releaseVersion = '$(ReleaseTag)' -replace '^v','' @@ -69,7 +86,7 @@ steps: $semanticVersion.Major.ToString() + "." + $semanticVersion.Minor.ToString() + ".md" } - $filePath = "$env:BUILD_SOURCESDIRECTORY/CHANGELOG/$fileName" + $filePath = "$env:BUILD_SOURCESDIRECTORY/PowerShell/CHANGELOG/$fileName" Write-Verbose -Verbose "Selected Log file: $filePath" if (-not (Test-Path $filePath)) { diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index 1fb5364302..44d09d45de 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -16,13 +16,11 @@ steps: $azcopy = Find-AzCopy Write-Verbose -Verbose "Found AzCopy: $azcopy" - & $azcopy login --service-principal --application-id $(PowerShellReleaseSPN) - & $azcopy cp https://$(StorageAccount).blob.core.windows.net/$(AzureVersion)/* $(System.ArtifactsDirectory) --recursive displayName: Download Azure Artifacts env: - AZCOPY_SPA_CLIENT_SECRET: $(PowerShellReleaseSPNSecret) + AZCOPY_AUTO_LOGIN_TYPE: MSI - pwsh: | Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty Name diff --git a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml index 61371fcfaa..83779c75aa 100644 --- a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml +++ b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml @@ -39,15 +39,13 @@ jobs: $azcopy = Find-AzCopy Write-Verbose -Verbose "Found AzCopy: $azcopy" - & $azcopy login --service-principal --application-id $(PowerShellReleaseSPN) - Write-Host "running: $azcopy cp https://$(StorageAccount).blob.core.windows.net/$(AzureVersion)/PowerShell-$(Version)-win-${{ parameters.architecture }}.zip $(System.ArtifactsDirectory)" & $azcopy cp https://$(StorageAccount).blob.core.windows.net/$(AzureVersion)/PowerShell-$(Version)-win-${{ parameters.architecture }}.zip $(System.ArtifactsDirectory) displayName: 'Download Azure Artifacts' retryCountOnTaskFailure: 2 env: - AZCOPY_SPA_CLIENT_SECRET: $(PowerShellReleaseSPNSecret) + AZCOPY_AUTO_LOGIN_TYPE: MSI - pwsh: 'Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty Name' displayName: 'Capture Artifact Listing' From a7d7526f6ea59ad2a2b2c20e7a45e4be896fcf8d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 15:34:22 -0700 Subject: [PATCH 53/66] Add telemetry to check for specific tags when importing a module (#20371) (#20540) --- .../engine/Modules/ImportModuleCommand.cs | 10 ++-- .../utils/Telemetry.cs | 59 +++++++++++++++++-- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs index dbbbf7286a..15e8bfe6a9 100644 --- a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs @@ -619,7 +619,7 @@ namespace Microsoft.PowerShell.Commands // avoid double reporting for WinCompat modules that go through CommandDiscovery\AutoloadSpecifiedModule if (!foundModule.IsWindowsPowerShellCompatModule) { - ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, foundModule.Name, foundModule.Version?.ToString()); + ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, foundModule); #if LEGACYTELEMETRY TelemetryAPI.ReportModuleLoad(foundModule); #endif @@ -893,7 +893,7 @@ namespace Microsoft.PowerShell.Commands if (foundModule != null) { - ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, foundModule.Name, foundModule.Version?.ToString()); + ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, foundModule); SetModuleBaseForEngineModules(foundModule.Name, this.Context); } @@ -935,7 +935,7 @@ namespace Microsoft.PowerShell.Commands // Send telemetry on the imported modules foreach (PSModuleInfo moduleInfo in remotelyImportedModules) { - ApplicationInsightsTelemetry.SendModuleTelemetryMetric(usingWinCompat ? TelemetryType.WinCompatModuleLoad : TelemetryType.ModuleLoad, moduleInfo.Name, moduleInfo.Version?.ToString()); + ApplicationInsightsTelemetry.SendModuleTelemetryMetric(usingWinCompat ? TelemetryType.WinCompatModuleLoad : TelemetryType.ModuleLoad, moduleInfo); } return remotelyImportedModules; @@ -1866,7 +1866,7 @@ namespace Microsoft.PowerShell.Commands // of doing Get-Module -list foreach (PSModuleInfo module in ModuleInfo) { - ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, module.Name, module.Version?.ToString()); + ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, module); RemoteDiscoveryHelper.DispatchModuleInfoProcessing( module, localAction: () => @@ -1926,7 +1926,7 @@ namespace Microsoft.PowerShell.Commands ImportModule_RemotelyViaPsrpSession(importModuleOptions, null, FullyQualifiedName, this.PSSession); foreach (ModuleSpecification modulespec in FullyQualifiedName) { - ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, modulespec.Name, modulespec.Version?.ToString()); + ApplicationInsightsTelemetry.SendModuleTelemetryMetric(TelemetryType.ModuleLoad, modulespec.Name); } } else if (this.ParameterSetName.Equals(ParameterSet_ViaWinCompat, StringComparison.OrdinalIgnoreCase) diff --git a/src/System.Management.Automation/utils/Telemetry.cs b/src/System.Management.Automation/utils/Telemetry.cs index a1c3d324b5..5588cb103a 100644 --- a/src/System.Management.Automation/utils/Telemetry.cs +++ b/src/System.Management.Automation/utils/Telemetry.cs @@ -5,11 +5,14 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Management.Automation; using System.Runtime.InteropServices; +using System.Security.AccessControl; using System.Threading; using Microsoft.ApplicationInsights; +using Microsoft.ApplicationInsights.Metrics; using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.Extensibility.Implementation; @@ -124,6 +127,9 @@ namespace Microsoft.PowerShell.Telemetry // Use '0.0' as the string for an anonymous module version private const string AnonymousVersion = "0.0"; + // Use 'n/a' as the string when there's no tag to report + private const string NoTag = "n/a"; + // the telemetry failure string private const string _telemetryFailure = "TELEMETRY_FAILURE"; @@ -140,9 +146,11 @@ namespace Microsoft.PowerShell.Telemetry private static int s_startupEventSent = 0; /// Use a hashset for quick lookups. - /// We send telemetry only a known set of modules. - /// If it's not in the list (initialized in the static constructor), then we report anonymous. + /// We send telemetry only a known set of modules and tags. + /// If it's not in the list (initialized in the static constructor), then we report anonymous + /// or don't report anything (in the case of tags). private static readonly HashSet s_knownModules; + private static readonly HashSet s_knownModuleTags; /// Gets a value indicating whether telemetry can be sent. public static bool CanSendTelemetry { get; private set; } = false; @@ -601,6 +609,12 @@ namespace Microsoft.PowerShell.Telemetry "xWindowsUpdate", }; + // use a hashset when looking for module names, it should be quicker than a string comparison + s_knownModuleTags = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "CrescendoBuilt", + }; + s_uniqueUserIdentifier = GetUniqueIdentifier().ToString(); } } @@ -671,6 +685,41 @@ namespace Microsoft.PowerShell.Telemetry return defaultValue; } + /// + /// Send module load telemetry as a metric. + /// For modules we send the module name (if allowed), and the version. + /// Some modules (CIM) will continue use the string alternative method. + /// + /// The type of telemetry that we'll be sending. + /// The module to report. If it is not allowed, then it is set to 'anonymous'. + internal static void SendModuleTelemetryMetric(TelemetryType telemetryType, PSModuleInfo moduleInfo) + { + if (!CanSendTelemetry) + { + return; + } + + // Package up the module name, version, and known tags as a metric. + // Note that the allowed tags will be a comma separated list which will need to + // be handled in the telemetry query. + try + { + string allowedModuleName = GetModuleName(moduleInfo.Name); + string allowedModuleVersion = allowedModuleName == Anonymous ? AnonymousVersion : moduleInfo.Version?.ToString(); + var allowedModuleTags = moduleInfo.Tags.Where(t => s_knownModuleTags.Contains(t)).Distinct(); + string allowedModuleTagString = allowedModuleTags.Any() ? string.Join(',', allowedModuleTags) : NoTag; + + s_telemetryClient. + GetMetric(new MetricIdentifier(string.Empty, telemetryType.ToString(), "uuid", "SessionId", "ModuleName", "Version", "Tag")). + TrackValue(metricValue: 1.0, s_uniqueUserIdentifier, s_sessionId, allowedModuleName, allowedModuleVersion, allowedModuleTagString); + } + catch + { + // Ignore errors. + } + + } + /// /// Send module load telemetry as a metric. /// For modules we send the module name (if allowed), and the version. @@ -678,8 +727,7 @@ namespace Microsoft.PowerShell.Telemetry /// /// The type of telemetry that we'll be sending. /// The module name to report. If it is not allowed, then it is set to 'anonymous'. - /// The module version to report. The default value is the anonymous version '0.0.0.0'. - internal static void SendModuleTelemetryMetric(TelemetryType telemetryType, string moduleName, string moduleVersion = AnonymousVersion) + internal static void SendModuleTelemetryMetric(TelemetryType telemetryType, string moduleName) { if (!CanSendTelemetry) { @@ -689,8 +737,7 @@ namespace Microsoft.PowerShell.Telemetry try { string allowedModuleName = GetModuleName(moduleName); - string allowedModuleVersion = allowedModuleName == Anonymous ? AnonymousVersion : moduleVersion; - s_telemetryClient.GetMetric(telemetryType.ToString(), "uuid", "SessionId", "ModuleName", "Version").TrackValue(metricValue: 1.0, s_uniqueUserIdentifier, s_sessionId, allowedModuleName, allowedModuleVersion); + s_telemetryClient.GetMetric(telemetryType.ToString(), "uuid", "SessionId", "ModuleName", "Version").TrackValue(metricValue: 1.0, s_uniqueUserIdentifier, s_sessionId, allowedModuleName, AnonymousVersion); } catch { From ab75f9d6a54681fa5febde4c30929baf75131726 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 15:44:01 -0700 Subject: [PATCH 54/66] Bump Microsoft.Management.Infrastructure (#20512) (#20545) --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj index 135b0fcba3..4b756e722a 100644 --- a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj +++ b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj @@ -8,7 +8,7 @@ 11.0 - + From 2135b1c93305483c08c9dba1176e37d370cb8863 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 16:06:31 -0700 Subject: [PATCH 55/66] Bump to .NET 8 RC2 (#20510) (#20543) --- DotnetRuntimeMetadata.json | 8 +++---- global.json | 2 +- ...oft.PowerShell.Commands.Diagnostics.csproj | 2 +- ...soft.PowerShell.Commands.Management.csproj | 2 +- ...crosoft.PowerShell.Commands.Utility.csproj | 4 ++-- ...crosoft.PowerShell.CoreCLR.Eventing.csproj | 2 +- .../Microsoft.PowerShell.SDK.csproj | 22 +++++++++---------- .../Microsoft.WSMan.Management.csproj | 2 +- .../System.Management.Automation.csproj | 16 +++++++------- .../BenchmarkDotNet.Extensions.csproj | 4 ++-- .../ResultsComparer/ResultsComparer.csproj | 2 +- ...soft.PowerShell.NamedPipeConnection.csproj | 2 +- test/tools/TestService/TestService.csproj | 2 +- test/tools/WebListener/WebListener.csproj | 4 ++-- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/DotnetRuntimeMetadata.json b/DotnetRuntimeMetadata.json index 464ca8a629..5b6ac60b80 100644 --- a/DotnetRuntimeMetadata.json +++ b/DotnetRuntimeMetadata.json @@ -1,13 +1,13 @@ { "sdk": { - "channel": "8.0.1xx-rc1", + "channel": "8.0.1xx-rc2", "quality": "daily", "qualityFallback": "preview", - "packageVersionPattern": "8.0.0-rc.1", + "packageVersionPattern": "8.0.0-rc.2", "sdkImageVersion": "8.0.100", - "nextChannel": "8.0.1xx-preview4", + "nextChannel": "8.0.1xx-rc2", "azureFeed": "", - "sdkImageOverride": "" + "sdkImageOverride": "8.0.100-rc.2.23502.2" }, "internalfeed": { "url": "" diff --git a/global.json b/global.json index adc5611968..3ecc5db745 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.100-rc.1.23463.5" + "version": "8.0.100-rc.2.23502.2" } } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj index e3fc9bd3cf..1e7f70bc8f 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index 4952214240..0d6c585478 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index f7410061a6..31b1082aa9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -33,8 +33,8 @@ - - + + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index 5922c52e36..3c00ae295b 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 3082c48bc2..85588f8b53 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -19,22 +19,22 @@ - - - + + + - - - - - - + + + + + + - + diff --git a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj index 4ab85c7959..084ba8e2ff 100644 --- a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj +++ b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index 2d45cea0f7..fe97fc5e56 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -34,16 +34,16 @@ - - - - + + + + - + - - - + + + diff --git a/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj b/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj index 0956c4122c..2a398dad17 100644 --- a/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj +++ b/test/perf/dotnet-tools/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj b/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj index 0fc8038691..a8b48dde15 100644 --- a/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj +++ b/test/perf/dotnet-tools/ResultsComparer/ResultsComparer.csproj @@ -9,7 +9,7 @@ - + diff --git a/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj b/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj index 6dcec1060f..b53f1921a7 100644 --- a/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj +++ b/test/tools/NamedPipeConnection/src/code/Microsoft.PowerShell.NamedPipeConnection.csproj @@ -15,6 +15,6 @@ - + diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index 561dac20d1..396c34ab46 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 89e69a428f..5e7fc468c6 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,8 +7,8 @@ - - + + From ce4cc672099b1dae51d8d9e9c06c43d9e389d8d0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 16:06:56 -0700 Subject: [PATCH 56/66] Bump Microsoft.Management.Infrastructure (#20511) (#20547) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../System.Management.Automation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index fe97fc5e56..1568b76ee0 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -45,7 +45,7 @@ - + From 240bd1f2cc7e86c50531312df43db2d47f29ce87 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 18:56:02 -0700 Subject: [PATCH 57/66] Fix `Test-Connection` due to .NET 8 changes (#20369) (#20531) --- .../commands/management/TestConnectionCommand.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs index 1f497e5dd2..1370a56ea9 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs @@ -56,7 +56,7 @@ namespace Microsoft.PowerShell.Commands #region Private Fields - private static byte[]? s_DefaultSendBuffer; + private static readonly byte[] s_DefaultSendBuffer = Array.Empty(); private readonly CancellationTokenSource _dnsLookupCancel = new(); @@ -484,7 +484,10 @@ namespace Microsoft.PowerShell.Commands reply.Status == IPStatus.Success ? reply.RoundtripTime : timer.ElapsedMilliseconds, - buffer.Length, + + // If we use the empty buffer, then .NET actually uses a 32 byte buffer so we want to show + // as the result object the actual buffer size used instead of 0. + buffer.Length == 0 ? DefaultSendBufferSize : buffer.Length, pingNum: i); WriteObject(new TraceStatus( currentHop, @@ -707,7 +710,7 @@ namespace Microsoft.PowerShell.Commands resolvedTargetName, reply, reply.RoundtripTime, - buffer.Length, + buffer.Length == 0 ? DefaultSendBufferSize : buffer.Length, pingNum: (uint)i)); } @@ -862,7 +865,7 @@ namespace Microsoft.PowerShell.Commands // Creates and fills a send buffer. This follows the ping.exe and CoreFX model. private static byte[] GetSendBuffer(int bufferSize) { - if (bufferSize == DefaultSendBufferSize && s_DefaultSendBuffer != null) + if (bufferSize == DefaultSendBufferSize) { return s_DefaultSendBuffer; } @@ -874,11 +877,6 @@ namespace Microsoft.PowerShell.Commands sendBuffer[i] = (byte)((int)'a' + i % 23); } - if (bufferSize == DefaultSendBufferSize && s_DefaultSendBuffer == null) - { - s_DefaultSendBuffer = sendBuffer; - } - return sendBuffer; } From b60d5659e7107f87c2abcbf3b553cec5a45e542c Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 18:56:29 -0700 Subject: [PATCH 58/66] Bump PSReadLine from 2.2.6 to 2.3.4 (#20305) (#20533) --- src/Modules/PSGalleryModules.csproj | 2 +- test/powershell/Modules/PSReadLine/PSReadLine.Tests.ps1 | 4 ++-- tools/packaging/boms/windows.json | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Modules/PSGalleryModules.csproj b/src/Modules/PSGalleryModules.csproj index f4d5d37475..80a1b7e202 100644 --- a/src/Modules/PSGalleryModules.csproj +++ b/src/Modules/PSGalleryModules.csproj @@ -15,7 +15,7 @@ - + diff --git a/test/powershell/Modules/PSReadLine/PSReadLine.Tests.ps1 b/test/powershell/Modules/PSReadLine/PSReadLine.Tests.ps1 index 6e5924d9c5..975f4f82da 100644 --- a/test/powershell/Modules/PSReadLine/PSReadLine.Tests.ps1 +++ b/test/powershell/Modules/PSReadLine/PSReadLine.Tests.ps1 @@ -12,13 +12,13 @@ Describe "PSReadLine" -tags "CI" { Import-Module PSReadLine $module = Get-Module PSReadLine $module.Name | Should -BeExactly 'PSReadLine' - $module.Version | Should -Match '^2.2.\d$' + $module.Version | Should -Match '^2.3.\d$' } It "Should be installed to `$PSHOME" { $module = Get-Module (Join-Path -Path $PSHOME -ChildPath "Modules" -AdditionalChildPath "PSReadLine") -ListAvailable $module.Name | Should -BeExactly 'PSReadLine' - $module.Version | Should -Match '^2.2.\d$' + $module.Version | Should -Match '^2.3.\d$' $module.Path | Should -Be (Join-Path -Path $PSHOME -ChildPath "Modules/PSReadLine/PSReadLine.psd1") } diff --git a/tools/packaging/boms/windows.json b/tools/packaging/boms/windows.json index f1a9bec1ed..4ec63b872c 100644 --- a/tools/packaging/boms/windows.json +++ b/tools/packaging/boms/windows.json @@ -827,6 +827,10 @@ "Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.psd1", "FileType": "NonProduct" }, + { + "Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.psm1", + "FileType": "NonProduct" + }, { "Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Notice.txt", "FileType": "NonProduct" @@ -900,7 +904,7 @@ "FileType": "NonProduct" }, { - "Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.psm1", + "Pattern": "Modules\\PSReadLine\\_manifest\\spdx_2.2\\manifest.cat", "FileType": "NonProduct" }, { From 0baa5b4b713fc84113669a9ede58575a2368ff60 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 21:53:56 -0700 Subject: [PATCH 59/66] Only registry App Path for release package (#20478) (#20549) Co-authored-by: Heath Stewart --- assets/wix/Product.wxs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/wix/Product.wxs b/assets/wix/Product.wxs index b4f9a5f90b..6f34a33849 100644 --- a/assets/wix/Product.wxs +++ b/assets/wix/Product.wxs @@ -151,7 +151,9 @@ - + + + @@ -209,13 +211,15 @@ - + + + DISABLE_TELEMETRY From a550c2ce0ef743411df58740b24fe64c775008ab Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 20 Oct 2023 12:34:17 -0700 Subject: [PATCH 60/66] Fix package version for .NET nuget packages (#20551) (#20552) --- .../Microsoft.PowerShell.Commands.Utility.csproj | 2 +- src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj | 2 +- test/tools/TestService/TestService.csproj | 2 +- test/tools/WebListener/WebListener.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 31b1082aa9..a23b657f61 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 85588f8b53..749e916eab 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -34,7 +34,7 @@ - + diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index 396c34ab46..ed5011fdc1 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 5e7fc468c6..3d9d5a4eda 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,7 +7,7 @@ - + From ef8559e2fb8cad710c6d61f7b8ec70a5fa59dc96 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 20 Oct 2023 15:56:55 -0700 Subject: [PATCH 61/66] Update CGManifest for release --- tools/cgmanifest.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/cgmanifest.json b/tools/cgmanifest.json index 741ae0cbf5..8b92f890ec 100644 --- a/tools/cgmanifest.json +++ b/tools/cgmanifest.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/component-detection-manifest.json", "Registrations": [ { "Component": { @@ -55,7 +56,7 @@ "Type": "nuget", "Nuget": { "Name": "JsonSchema.Net", - "Version": "5.2.5" + "Version": "5.2.6" } }, "DevelopmentDependency": false @@ -575,7 +576,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Private.ServiceModel", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -695,7 +696,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.Duplex", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -705,7 +706,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.Http", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -715,7 +716,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.NetTcp", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -725,7 +726,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.Primitives", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -735,7 +736,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.Security", - "Version": "4.10.2" + "Version": "4.10.3" } }, "DevelopmentDependency": false @@ -830,6 +831,5 @@ }, "DevelopmentDependency": false } - ], - "$schema": "https://json.schemastore.org/component-detection-manifest.json" + ] } From 7198f70eb303c5ae9e6f4593a679a44e20e25d00 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 23 Oct 2023 18:31:08 +0000 Subject: [PATCH 62/66] Merged PR 28110: Update ThirdPartyNotices.txt file Update ThirdPartyNotices.txt file --- ThirdPartyNotices.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index cfda222696..b7d54550af 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -238,7 +238,7 @@ SOFTWARE. --------------------------------------------------------- -JsonSchema.Net 5.2.5 - MIT +JsonSchema.Net 5.2.6 - MIT @@ -2989,7 +2989,7 @@ SOFTWARE. --------------------------------------------------------- -System.Private.ServiceModel 4.10.2 - MIT +System.Private.ServiceModel 4.10.3 - MIT (c) Microsoft Corporation @@ -3854,7 +3854,7 @@ SOFTWARE. --------------------------------------------------------- -System.ServiceModel.Duplex 4.10.2 - MIT +System.ServiceModel.Duplex 4.10.3 - MIT (c) Microsoft Corporation @@ -3890,7 +3890,7 @@ SOFTWARE. --------------------------------------------------------- -System.ServiceModel.Http 4.10.2 - MIT +System.ServiceModel.Http 4.10.3 - MIT (c) Microsoft Corporation @@ -3926,7 +3926,7 @@ SOFTWARE. --------------------------------------------------------- -System.ServiceModel.NetTcp 4.10.2 - MIT +System.ServiceModel.NetTcp 4.10.3 - MIT (c) Microsoft Corporation @@ -3962,7 +3962,7 @@ SOFTWARE. --------------------------------------------------------- -System.ServiceModel.Primitives 4.10.2 - MIT +System.ServiceModel.Primitives 4.10.3 - MIT (c) Microsoft Corporation @@ -3998,7 +3998,7 @@ SOFTWARE. --------------------------------------------------------- -System.ServiceModel.Security 4.10.2 - MIT +System.ServiceModel.Security 4.10.3 - MIT (c) Microsoft Corporation From 1727de38af5982fb0ff020e2228e8bbd56948854 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 23 Oct 2023 22:51:14 +0000 Subject: [PATCH 63/66] Merged PR 28127: Update agent pool to allow MSI to Azure blob Update agent pool to allow MSI to Azure blob --- tools/releaseBuild/azureDevOps/releasePipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releasePipeline.yml b/tools/releaseBuild/azureDevOps/releasePipeline.yml index b406dd0b73..fb6b8d5d95 100644 --- a/tools/releaseBuild/azureDevOps/releasePipeline.yml +++ b/tools/releaseBuild/azureDevOps/releasePipeline.yml @@ -147,8 +147,9 @@ stages: - job: ValidatePkgNames displayName: Validate Package Names pool: - # testing - vmImage: windows-latest + name: PowerShell1ES + demands: + - ImageOverride -equals PSMMS2019-Secure variables: - group: 'Azure Blob variable group' steps: From 30883500129f8db93c46f1f2467e006082378413 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 24 Oct 2023 02:32:26 +0000 Subject: [PATCH 64/66] Merged PR 28126: Update changelog for v7.4.0-rc.1 Update changelog for v7.4.0-rc.1 --- CHANGELOG/preview.md | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CHANGELOG/preview.md b/CHANGELOG/preview.md index 11027a4512..d8ba3d0958 100644 --- a/CHANGELOG/preview.md +++ b/CHANGELOG/preview.md @@ -1,5 +1,51 @@ # Current preview release +## [7.4.0-rc.1] - 2023-10-24 + +### General Cmdlet Updates and Fixes + +- Fix `Test-Connection` due to .NET 8 changes (#20369) (#20531) +- Add telemetry to check for specific tags when importing a module (#20371) (#20540) +- Fix `Copy-Item` progress to only show completed when all files are copied (#20517) (#20544) +- Fix `unixmode` to handle `setuid` and `sticky` when file is not an executable (#20366) (#20537) +- Fix UNC path completion regression (#20419) (#20541) +- Fix implicit remoting proxy cmdlets to act on common parameters (#20367) (#20530) +- Fix `Get-Service` non-terminating error message to include category (#20276) (#20529) +- Fixing regression in DSC (#20268) (#20528) + +### Build and Packaging Improvements + +
+ + + +

We thank the following contributors!

+ +
+ +
    +
  • Update ThirdPartyNotices.txt file (Internal 28110)
  • +
  • Update CGManifest for release
  • +
  • Fix package version for .NET nuget packages (#20551) (#20552)
  • +
  • Only registry App Path for release package (#20478) (#20549)
  • +
  • Bump PSReadLine from 2.2.6 to 2.3.4 (#20305) (#20533)
  • +
  • Bump Microsoft.Management.Infrastructure (#20511) (#20512) (#20433) (#20434) (#20534) (#20535) (#20545) (#20547)
  • +
  • Bump to .NET 8 RC2 (#20510) (#20543)
  • + +
  • Add SBOM for release pipeline (#20519) (#20548)
  • +
  • Bump version of Microsoft.PowerShell.PSResourceGet to v1.0.0 (#20485) (#20538)
  • +
  • Bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 (#20486) (#20542)
  • +
  • Bump JsonSchema.Net from 5.2.5 to 5.2.6 (#20421) (#20532)
  • +
  • Fix alpine tar package name and do not crossgen alpine fxdependent package (#20459) (#20536)
  • +
  • Increase timeout when publishing packages to packages.microsoft.com (#20470) (#20539)
  • +
  • Block any preview vPack release (#20243) (#20526)
  • +
  • Add surrogate file for compliance scanning (#20423)
  • +
+ +
+ +[7.4.0-rc.1]: https://github.com/PowerShell/PowerShell/compare/v7.4.0-preview.6...v7.4.0-rc.1 + ## [7.4.0-preview.6] - 2023-09-28 ### General Cmdlet Updates and Fixes From b5db0ad1e469d2a4324180351679431d747dd43f Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 24 Oct 2023 20:47:05 +0000 Subject: [PATCH 65/66] Merged PR 28142: Update tar.gz package expected pattern for Alpine no-opt package Update tar.gz package expected pattern for Alpine no-opt package --- .../azureDevOps/templates/release-ValidatePackageNames.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index 44d09d45de..2a0a19e4ca 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -42,7 +42,7 @@ steps: - pwsh: | $message = @() Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.tar.gz | ForEach-Object { - if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl\-fxdependent)\.(tar\.gz)') + if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl-noopt\-fxdependent)\.(tar\.gz)') { $messageInstance = "$($_.Name) is not a valid package name" $message += $messageInstance From 0e2c97e8437f894740cecc0eee093191076385f7 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 24 Oct 2023 21:22:55 +0000 Subject: [PATCH 66/66] Merged PR 28143: Update tar.gz package expected pattern for Alpine opt package Update tar.gz package expected pattern for Alpine opt package --- .../azureDevOps/templates/release-ValidatePackageNames.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml index 2a0a19e4ca..8e41fbc4a5 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-ValidatePackageNames.yml @@ -42,7 +42,7 @@ steps: - pwsh: | $message = @() Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.tar.gz | ForEach-Object { - if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl-noopt\-fxdependent)\.(tar\.gz)') + if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl-noopt\-fxdependent)\.(tar\.gz)') { $messageInstance = "$($_.Name) is not a valid package name" $message += $messageInstance