From a8fe6e2b31166aeada3a44ef4ab7e097ebb2e9ec Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 7 Oct 2026 02:07:31 +0000 Subject: [PATCH 1/4] Backflow from https://github.com/dotnet/dotnet / c36f5f6 build 335390 Diff: https://github.com/dotnet/dotnet/compare/08c9136025fb143926499e81c06608572e204ba4..c36f5f641e3dea81f9ab824316f7a2d168277ea3 From: https://github.com/dotnet/dotnet/commit/08c9136025fb143926499e81c06608572e204ba4 To: https://github.com/dotnet/dotnet/commit/c36f5f641e3dea81f9ab824316f7a2d168277ea3 [[ commit created by automation ]] --- NuGet.config | 2 ++ eng/Build.ps1 | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/NuGet.config b/NuGet.config index a6df74bb15e..7bc9d52549b 100644 --- a/NuGet.config +++ b/NuGet.config @@ -23,6 +23,8 @@ + + diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 3b34d6e9a94..50ae064e68e 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -81,11 +81,6 @@ param ( Set-StrictMode -version 2.0 $ErrorActionPreference = "Stop" -# MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. -# tools.ps1 reads $msbuildMultiThreaded, so this has to be settled before Arcade is imported. -if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false -} $BuildCategory = "" $BuildMessage = "" From 142bc1fb5ee6589e52a6e973e6c854ed76444b7d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 7 Oct 2026 02:07:37 +0000 Subject: [PATCH 2/4] Update dependencies from build 335390 No dependency updates to commit [[ commit created by automation ]] --- eng/Version.Details.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c2e7b96c6f2..6c812a02fcc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,6 +1,6 @@ - + https://github.com/dotnet/msbuild From 9dd94c2926374b8950197547c63d270515217f6d Mon Sep 17 00:00:00 2001 From: Copilot Date: Wed, 7 Oct 2026 16:27:26 +0200 Subject: [PATCH 3/4] Fix CI failures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- azure-pipelines-PR.yml | 14 +++++++-- .../.FSharp.Compiler.Service/11.0.200.md | 1 + src/Compiler/Facilities/AsyncMemoize.fs | 5 +++- .../CompilerService/AsyncMemoize.fs | 30 +++++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index 18d1c38f3bd..95927d469d0 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -496,8 +496,13 @@ stages: - script: ./eng/common/dotnet.sh fsi tests/EndToEndBuildTests/MultithreadedTasks/run.fsx -- --configuration $(_BuildConfig) --repetitions 3 displayName: Real SDK MP / MT integration condition: and(succeeded(), eq(variables['batchNumber'], '1')) - - task: PublishPipelineArtifact@1 + - pwsh: | + $exists = Test-Path -LiteralPath "$(Build.SourcesDirectory)/artifacts/MultithreadedTasks" -PathType Container + Write-Host "##vso[task.setvariable variable=SdkMtEvidenceAvailable]$exists" + displayName: Check SDK MT evidence condition: and(always(), eq(variables['batchNumber'], '1')) + - task: PublishPipelineArtifact@1 + condition: and(always(), eq(variables['batchNumber'], '1'), eq(variables['SdkMtEvidenceAvailable'], 'true')) inputs: targetPath: '$(Build.SourcesDirectory)/artifacts/MultithreadedTasks' artifact: Linux SDK MT evidence @@ -544,8 +549,13 @@ stages: displayName: End to end build tests - script: .\eng\common\dotnet.cmd fsi tests\EndToEndBuildTests\MultithreadedTasks\run.fsx -- --configuration Release --repetitions 3 displayName: Real SDK MP / MT integration - - task: PublishPipelineArtifact@1 + - pwsh: | + $exists = Test-Path -LiteralPath "$(Build.SourcesDirectory)/artifacts/MultithreadedTasks" -PathType Container + Write-Host "##vso[task.setvariable variable=SdkMtEvidenceAvailable]$exists" + displayName: Check SDK MT evidence condition: always() + - task: PublishPipelineArtifact@1 + condition: and(always(), eq(variables['SdkMtEvidenceAvailable'], 'true')) inputs: targetPath: '$(Build.SourcesDirectory)/artifacts/MultithreadedTasks' artifact: Windows SDK MT evidence diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.200.md index 5a3649f260b..3fa180c2608 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.200.md @@ -9,6 +9,7 @@ * `FsiEvaluationSession.EvalInteraction` and `EvalInteractionNonThrowing` evaluate every `;;`-separated interaction in the text they are given, as their documentation has always said, instead of silently discarding everything after the first. ([PR #20396](https://github.com/dotnet/fsharp/pull/20396)) * Preserve constraint inference order when explicit generic arguments share a caller type parameter, avoiding spurious FS0001 errors with multiply implemented generic interfaces. ([PR #20491](https://github.com/dotnet/fsharp/pull/20491)) * Preserve tupled lambda argument groups when reducing state-machine applications, avoiding invalid argument substitutions and runtime failures with inline formatters. ([Issue #20675](https://github.com/dotnet/fsharp/issues/20675), [PR #20700](https://github.com/dotnet/fsharp/pull/20700)) +* Keep shared compiler service computations running when another request is canceled before attaching to the computation. ([PR #20722](https://github.com/dotnet/fsharp/pull/20722)) ### Changed diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs index 16f4787209d..cc652c24f90 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fs +++ b/src/Compiler/Facilities/AsyncMemoize.fs @@ -93,8 +93,11 @@ type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool, member _.Request() = async { + // Register before try/finally, whose cleanup runs even when cancellation skips its body. + let computation = withStateUpdate request + try - return! withStateUpdate request + return! computation finally updateState afterRequest } diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index bb8ab98d839..497098aa5c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -283,6 +283,36 @@ let ``Job keeps running if only one requestor cancels`` () : Task = Finished, key ] } +[] +let ``Job keeps running when requests cancel before attaching`` () : Task = + task { + use jobStarted = new ManualResetEvent(false) + use jobCanComplete = new ManualResetEvent(false) + + let computation = async { + jobStarted.Set() |> ignore + do! awaitHandle jobCanComplete + return 42 + } + + let memoize = AsyncMemoize<_, int, _>() + let request = memoize.Get(wrapKey 1, computation) + let survivor = Async.StartAsTask request + + do! awaitHandle jobStarted + + for delay in 0 .. 9999 do + use cts = new CancellationTokenSource() + let other = Async.StartAsTask(request, cancellationToken = cts.Token) + Thread.SpinWait (delay % 1000) + cts.Cancel() + do! assertTaskCanceled other + + jobCanComplete.Set() |> ignore + let! result = survivor + Assert.Equal(42, result) + } + type ExpectedException() = inherit Exception() From d8612412918d87d6645f36b26ae4a50b2b0484dc Mon Sep 17 00:00:00 2001 From: Copilot Date: Fri, 9 Oct 2026 12:29:16 +0200 Subject: [PATCH 4/4] Fix CI failures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/tests/SetupPrValidation.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/tests/SetupPrValidation.Tests.ps1 b/eng/tests/SetupPrValidation.Tests.ps1 index 4e0a15924f7..955284e50c5 100644 --- a/eng/tests/SetupPrValidation.Tests.ps1 +++ b/eng/tests/SetupPrValidation.Tests.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = 'Stop' $setup = Join-Path $PSScriptRoot '..\setup-pr-validation.ps1' $root = Join-Path ([IO.Path]::GetTempPath()) ("fsharp-pr-validation-" + [Guid]::NewGuid()) -$git = (Get-Command git -CommandType Application).Source +$git = (Get-Command git -CommandType Application | Select-Object -First 1).Source $previousGlobalConfig = $env:GIT_CONFIG_GLOBAL $previousSystemConfig = $env:GIT_CONFIG_NOSYSTEM