From ce2f0c0d60b7cceabd09dc300a38d4aaca6ee34c Mon Sep 17 00:00:00 2001 From: Ryan <69221034+ryfu-msft@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:55:36 -0800 Subject: [PATCH] Cherry pick: Fix xamlAsset value (powershell module) (#4240) and Fix PowerShellCmdlet (#4247) (#4248) --- src/PowerShell/CommonFiles/PowerShellCmdlet.cs | 16 +++++++++++----- .../Helpers/AppxModuleHelper.cs | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/PowerShell/CommonFiles/PowerShellCmdlet.cs b/src/PowerShell/CommonFiles/PowerShellCmdlet.cs index 03d4ea188e..bd66db5ef7 100644 --- a/src/PowerShell/CommonFiles/PowerShellCmdlet.cs +++ b/src/PowerShell/CommonFiles/PowerShellCmdlet.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. Licensed under the MIT License. // @@ -281,6 +281,7 @@ internal void Wait(Task runningTask, PowerShellCmdlet? writeCmdlet = null) { try { + this.pwshThreadEdi = null; this.pwshThreadAction(); } catch (Exception e) @@ -596,12 +597,17 @@ private void WaitMainThreadActionCompletion() this.pwshThreadActionCompleted.WaitHandle, }); - if (this.pwshThreadEdi != null) + try { - this.pwshThreadEdi.Throw(); + if (this.pwshThreadEdi != null) + { + this.pwshThreadEdi.Throw(); + } + } + finally + { + this.semaphore.Release(); } - - this.semaphore.Release(); } private class QueuedStream diff --git a/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs b/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs index f300781ae4..16056821c7 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs @@ -379,10 +379,10 @@ private async Task InstallVCLibsDependenciesAsync() private async Task InstallUiXamlAsync(string releaseTag) { (string xamlPackageName, string xamlReleaseTag) = GetXamlDependencyVersionInfo(releaseTag); - string xamlAssetX64 = string.Format($"{0}.x64.appx", xamlPackageName); - string xamlAssetX86 = string.Format($"{0}.x86.appx", xamlPackageName); - string xamlAssetArm = string.Format($"{0}.arm.appx", xamlPackageName); - string xamlAssetArm64 = string.Format($"{0}.arm64.appx", xamlPackageName); + string xamlAssetX64 = string.Format("{0}.x64.appx", xamlPackageName); + string xamlAssetX86 = string.Format("{0}.x86.appx", xamlPackageName); + string xamlAssetArm = string.Format("{0}.arm.appx", xamlPackageName); + string xamlAssetArm64 = string.Format("{0}.arm64.appx", xamlPackageName); var uiXamlObjs = this.GetAppxObject(xamlPackageName); if (uiXamlObjs is null)