Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<add key="dotnet10-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10-transport/nuget/v3/index.json" />
<add key="dotnet11" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json" />
<add key="dotnet11-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11-transport/nuget/v3/index.json" />
<add key="dotnet12" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet12/nuget/v3/index.json" />
<add key="dotnet12-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet12-transport/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="vssdk" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
<add key="vssdk-archived" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk-archived/nuget/v3/index.json" />
Expand Down
14 changes: 12 additions & 2 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,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 = ""

Expand Down
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="a2f466a2ccc2851d3c665f764a36b0cb59dd18b8" BarId="334576" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="c36f5f641e3dea81f9ab824316f7a2d168277ea3" BarId="335390" />
<ProductDependencies>
<Dependency Name="Microsoft.Build" Version="18.13.0-1.26502.3">
<Uri>https://github.com/dotnet/msbuild</Uri>
Expand Down
5 changes: 4 additions & 1 deletion src/Compiler/Facilities/AsyncMemoize.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,36 @@ let ``Job keeps running if only one requestor cancels`` () : Task =
Finished, key ]
}

[<Fact>]
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()

Expand Down
Loading