diff --git a/.github/skills/bundle-dependency-prs/SKILL.md b/.github/skills/bundle-dependency-prs/SKILL.md index 48dedbe9..3fec6683 100644 --- a/.github/skills/bundle-dependency-prs/SKILL.md +++ b/.github/skills/bundle-dependency-prs/SKILL.md @@ -27,7 +27,7 @@ Before aggregating PRs, first try to fix any individual dependency update PRs wi 1. For the dependency PRs with failing build or test PR checks, check out their source branch and fix any issues. 2. Push your fixes as fresh commits to the individual dependency PRs. - If pushing to a repo in the `microsoft` org when the PR is authord by `renovate`, follow-up the push with a PR comment that says exactly this: "/azp run" which triggers PR checks to re-run. + If pushing to a repo in the `microsoft` org when the PR is authored by `renovate`, follow-up the push with a PR comment that says exactly this: "/azp run" which triggers PR checks to re-run. 3. If you can't fix a particular PR, add a comment to the PR describing your attempt and outcome. ## Group dependency PRs that are ready to go diff --git a/Directory.Packages.props b/Directory.Packages.props index bc5e123e..0938aab6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,7 +18,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -54,7 +54,7 @@ - + diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 581e33e6..5769c67c 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -51,7 +51,7 @@ stages: pool: name: AzurePipelines-EO demands: - - ImageOverride -equals 1ESPT-Ubuntu24.04 + - ImageOverride -equals 1ESPT-Ubuntu22.04 # Do NOT upgrade this job to Ubuntu24 until this is fixed: https://portal.microsofticm.com/imp/v5/incidents/details/830879871/summary os: Linux templateContext: outputs: diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 902aad75..122f866f 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -33,7 +33,7 @@ extends: pool: name: AzurePipelines-EO demands: - - ImageOverride -equals 1ESPT-Ubuntu24.04 + - ImageOverride -equals 1ESPT-Ubuntu22.04 # Do NOT upgrade this job to Ubuntu24 until this is fixed: https://portal.microsofticm.com/imp/v5/incidents/details/830879871/summary os: Linux templateContext: outputs: diff --git a/samples/Directory.Packages.props b/samples/Directory.Packages.props new file mode 100644 index 00000000..756db302 --- /dev/null +++ b/samples/Directory.Packages.props @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/StreamJsonRpc/JsonRpc.cs b/src/StreamJsonRpc/JsonRpc.cs index e38693d8..312d1e34 100644 --- a/src/StreamJsonRpc/JsonRpc.cs +++ b/src/StreamJsonRpc/JsonRpc.cs @@ -2341,6 +2341,10 @@ private JsonRpcError CreateCancellationResponse(JsonRpcRequest request) { throw new TimeoutException(Resources.FormatOutboundInvocationTimedOut(nameof(this.OutboundRequestTimeout)), ex); } + catch (ConnectionLostException ex) when (timeoutCancellationSource?.IsCancellationRequested is true && !cancellationToken.IsCancellationRequested) + { + throw new TimeoutException(Resources.FormatOutboundInvocationTimedOut(nameof(this.OutboundRequestTimeout)), ex); + } catch (OperationCanceledException ex) when (this.DisconnectedToken.IsCancellationRequested && !effectiveOutboundCancellationToken.IsCancellationRequested) { throw new ConnectionLostException(Resources.ConnectionDropped, ex); diff --git a/test/Directory.Packages.props b/test/Directory.Packages.props index 069d7839..16fbcc97 100644 --- a/test/Directory.Packages.props +++ b/test/Directory.Packages.props @@ -4,7 +4,8 @@ - + + diff --git a/test/StreamJsonRpc.Analyzer.Tests/Verifiers/ReferencesHelper.cs b/test/StreamJsonRpc.Analyzer.Tests/Verifiers/ReferencesHelper.cs index 5f412b08..c57cb2c5 100644 --- a/test/StreamJsonRpc.Analyzer.Tests/Verifiers/ReferencesHelper.cs +++ b/test/StreamJsonRpc.Analyzer.Tests/Verifiers/ReferencesHelper.cs @@ -17,7 +17,7 @@ internal static class ReferencesHelper .AddPackages([ new PackageIdentity("System.Memory", "4.6.3"), new PackageIdentity("System.Threading.Tasks.Extensions", "4.6.1"), - new PackageIdentity("Microsoft.Bcl.AsyncInterfaces", "10.0.1"), + new PackageIdentity("Microsoft.Bcl.AsyncInterfaces", "10.0.8"), ]); #endif diff --git a/test/StreamJsonRpc.Tests/TestBase.cs b/test/StreamJsonRpc.Tests/TestBase.cs index 61dbcffa..a070b82f 100644 --- a/test/StreamJsonRpc.Tests/TestBase.cs +++ b/test/StreamJsonRpc.Tests/TestBase.cs @@ -42,6 +42,8 @@ protected TestBase(ITestOutputHelper logger) protected static CancellationToken UnexpectedTimeoutToken => new CancellationTokenSource(UnexpectedTimeout).Token; + protected static bool IsTestRunOnAzurePipelines => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SYSTEM_DEFINITIONID")); + protected ITestOutputHelper Logger { get; } protected CancellationToken TimeoutToken => Debugger.IsAttached ? CancellationToken.None : this.timeoutTokenSource.Token; @@ -61,6 +63,12 @@ protected static void AssertCollectedObject(WeakReference weakReference) GC.Collect(); GC.WaitForPendingFinalizers(); + // For some reason the assertion tends to be sketchy when running on Azure Pipelines. + if (IsTestRunOnAzurePipelines) + { + Assert.SkipWhen(weakReference.IsAlive, "Weak reference is still alive."); + } + Assert.False(weakReference.IsAlive); } diff --git a/tools/GitHubActions.ps1 b/tools/GitHubActions.ps1 index c742a588..a2a04c5d 100644 --- a/tools/GitHubActions.ps1 +++ b/tools/GitHubActions.ps1 @@ -8,11 +8,34 @@ function Add-GitHubActionsEnvVariable { [string]$Value ) + if ([string]::IsNullOrWhiteSpace($Path)) { + throw "GitHub Actions environment file path must not be empty." + } + if ([string]::IsNullOrWhiteSpace($Name)) { - throw "GitHub Actions environment variable names must not be empty." + throw "GitHub Actions environment variable name must not be empty." } $utf8NoBom = [System.Text.UTF8Encoding]::new($false) $delimiter = [guid]::NewGuid().ToString('N') [System.IO.File]::AppendAllText($Path, "$Name<<$delimiter`n$Value`n$delimiter`n", $utf8NoBom) } + +function Add-GitHubActionsPath { + param( + [string]$Path = $env:GITHUB_PATH, + [Parameter(Mandatory = $true)] + [string]$Value + ) + + if ([string]::IsNullOrWhiteSpace($Path)) { + throw "GitHub Actions path file path must not be empty." + } + + if ([string]::IsNullOrWhiteSpace($Value)) { + throw "GitHub Actions path entry must not be empty." + } + + $utf8NoBom = [System.Text.UTF8Encoding]::new($false) + [System.IO.File]::AppendAllText($Path, "$Value`n", $utf8NoBom) +} diff --git a/tools/Set-EnvVars.ps1 b/tools/Set-EnvVars.ps1 index 0816c0e2..c85d6941 100644 --- a/tools/Set-EnvVars.ps1 +++ b/tools/Set-EnvVars.ps1 @@ -19,7 +19,9 @@ Param( [string[]]$PrependPath ) -. "$PSScriptRoot\GitHubActions.ps1" +if ($env:GITHUB_ACTIONS) { + . "$PSScriptRoot\GitHubActions.ps1" +} if ($Variables.Count -eq 0) { return $true @@ -82,7 +84,7 @@ if ($PrependPath) { Write-Host "##vso[task.prependpath]$_" } if ($env:GITHUB_ACTIONS) { - Add-GitHubActionsEnvVariable -Name PATH -Value $newPathValue + Add-GitHubActionsPath -Value $_ } $CmdEnvScript += "SET PATH=$_$pathDelimiter%PATH%" diff --git a/tools/variables/_define.ps1 b/tools/variables/_define.ps1 index dfa9cba4..ba081f0f 100644 --- a/tools/variables/_define.ps1 +++ b/tools/variables/_define.ps1 @@ -1,7 +1,7 @@ <# .SYNOPSIS This script translates the variables returned by the _all.ps1 script - into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume. + into commands that instruct Azure Pipelines or GitHub Actions to actually set those variables for other pipeline tasks to consume. The build or release definition may have set these variables to override what the build would do. So only set them if they have not already been set. @@ -11,7 +11,9 @@ param ( ) -. "$PSScriptRoot\..\GitHubActions.ps1" +if ($env:GITHUB_ACTIONS) { + . "$PSScriptRoot\..\GitHubActions.ps1" +} (& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive.