diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 34f03e2..3c5dd82 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,7 +24,7 @@ // https://github.com/devcontainers/features/blob/main/src/dotnet/README.md "ghcr.io/devcontainers/features/dotnet:2": { "version": "8.0", - "additionalVersions": "6.0, 7.0" + "additionalVersions": "6.0" } }, "overrideFeatureInstallOrder": [ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e81c3f3..12404b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,6 @@ jobs: global-json-file: global.json dotnet-version: | 8.x - 7.x 6.x # Build on mac/linux - name: Build via Bash diff --git a/README.md b/README.md index 85efd82..6b8257b 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,7 @@ IcedTasks | [![NuGet Badge](https://buildstats.info/nuget/IcedTasks)](https://ww Make sure the following **requirements** are installed on your system: -- [dotnet SDK](https://www.microsoft.com/net/download/core) 7.0 or higher +- [dotnet SDK](https://www.microsoft.com/net/download/core) 6.0 & 8.0 or diff --git a/benchmarks/CSharpTaskBenchmarks/CSharpTaskBenchmarks.csproj b/benchmarks/CSharpTaskBenchmarks/CSharpTaskBenchmarks.csproj index bddc468..5c2e830 100644 --- a/benchmarks/CSharpTaskBenchmarks/CSharpTaskBenchmarks.csproj +++ b/benchmarks/CSharpTaskBenchmarks/CSharpTaskBenchmarks.csproj @@ -1,11 +1,11 @@ - net6.0;net7.0 + net6.0;net8.0 enable enable false - \ No newline at end of file + diff --git a/benchmarks/FSharpBenchmarks/asyncCompletion.ps1 b/benchmarks/FSharpBenchmarks/asyncCompletion.ps1 index 9cc8d2d..4d188f6 100644 --- a/benchmarks/FSharpBenchmarks/asyncCompletion.ps1 +++ b/benchmarks/FSharpBenchmarks/asyncCompletion.ps1 @@ -1 +1 @@ -dotnet run -c Release -f net7.0 -- --filter "*IcedTasks.Benchmarks.AsyncCompletionBenchmarks*" +dotnet run -c Release -f net8.0 -- --filter "*IcedTasks.Benchmarks.AsyncCompletionBenchmarks*" diff --git a/benchmarks/FSharpBenchmarks/benchmarks.fsproj b/benchmarks/FSharpBenchmarks/benchmarks.fsproj index f7af51d..198b5f7 100644 --- a/benchmarks/FSharpBenchmarks/benchmarks.fsproj +++ b/benchmarks/FSharpBenchmarks/benchmarks.fsproj @@ -1,7 +1,7 @@ Exe - net6.0;net7.0 + net6.0;net8.0 true @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/benchmarks/FSharpBenchmarks/fileWriting.ps1 b/benchmarks/FSharpBenchmarks/fileWriting.ps1 index c05abee..cda9995 100644 --- a/benchmarks/FSharpBenchmarks/fileWriting.ps1 +++ b/benchmarks/FSharpBenchmarks/fileWriting.ps1 @@ -1 +1 @@ -dotnet run -c Release -f net7.0 -- --filter "*IcedTasks.Benchmarks.FileWriteBenchmarks*" --runtimes net6.0 net7.0 +dotnet run -c Release -f net8.0 -- --filter "*IcedTasks.Benchmarks.FileWriteBenchmarks*" --runtimes net6.0 net8.0 diff --git a/benchmarks/FSharpBenchmarks/syncCompletion.ps1 b/benchmarks/FSharpBenchmarks/syncCompletion.ps1 index 31c918d..85935b4 100644 --- a/benchmarks/FSharpBenchmarks/syncCompletion.ps1 +++ b/benchmarks/FSharpBenchmarks/syncCompletion.ps1 @@ -1 +1 @@ -dotnet run -c Release -f net7.0 -- --filter "*IcedTasks.Benchmarks.SyncCompletionBenchmarks*" +dotnet run -c Release -f net8.0 -- --filter "*IcedTasks.Benchmarks.SyncCompletionBenchmarks*" diff --git a/build/build.fsproj b/build/build.fsproj index 2d1dcc4..55bcfeb 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 3390;$(WarnOn) false @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/examples/DatabaseDemo/DatabaseDemo.fsproj b/examples/DatabaseDemo/DatabaseDemo.fsproj index 1a6fe7f..f3eb528 100644 --- a/examples/DatabaseDemo/DatabaseDemo.fsproj +++ b/examples/DatabaseDemo/DatabaseDemo.fsproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/global.json b/global.json index 48e1c84..9b4f20a 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,6 @@ { "sdk": { - "version": "8.0.100" + "version": "8.0.100", + "rollForward": "latestMinor" } } diff --git a/tests/IcedTasks.Tests.NS20/IcedTasks.Tests.NS20.fsproj b/tests/IcedTasks.Tests.NS20/IcedTasks.Tests.NS20.fsproj index cff570a..c1bea38 100644 --- a/tests/IcedTasks.Tests.NS20/IcedTasks.Tests.NS20.fsproj +++ b/tests/IcedTasks.Tests.NS20/IcedTasks.Tests.NS20.fsproj @@ -2,7 +2,7 @@ Exe - net8.0;net6.0;net7.0 + net8.0;net6.0; false $(DefineConstants);NETSTANDARD2_0;TEST_NETSTANDARD2_0 diff --git a/tests/IcedTasks.Tests.NS21/IcedTasks.Tests.NS21.fsproj b/tests/IcedTasks.Tests.NS21/IcedTasks.Tests.NS21.fsproj index 309c71e..565ba6a 100644 --- a/tests/IcedTasks.Tests.NS21/IcedTasks.Tests.NS21.fsproj +++ b/tests/IcedTasks.Tests.NS21/IcedTasks.Tests.NS21.fsproj @@ -2,7 +2,7 @@ Exe - net8.0;net6.0;net7.0 + net8.0;net6.0; false $(DefineConstants);NETSTANDARD2_1;TEST_NETSTANDARD2_1 diff --git a/tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs b/tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs index ea6c6b9..e89510a 100644 --- a/tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs +++ b/tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs @@ -968,7 +968,7 @@ module CancellablePoolingValueTaskTests = let doOtherStuff (l: ResizeArray<_>) x = cancellablePoolingValueTask { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt diff --git a/tests/IcedTasks.Tests/CancellableTaskTests.fs b/tests/IcedTasks.Tests/CancellableTaskTests.fs index aca6c51..67cce67 100644 --- a/tests/IcedTasks.Tests/CancellableTaskTests.fs +++ b/tests/IcedTasks.Tests/CancellableTaskTests.fs @@ -927,7 +927,7 @@ module CancellableTaskTests = let doOtherStuff (l: ResizeArray<_>) x = cancellableTask { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt diff --git a/tests/IcedTasks.Tests/CancellableValueTaskTests.fs b/tests/IcedTasks.Tests/CancellableValueTaskTests.fs index 479a9c3..5831062 100644 --- a/tests/IcedTasks.Tests/CancellableValueTaskTests.fs +++ b/tests/IcedTasks.Tests/CancellableValueTaskTests.fs @@ -958,14 +958,13 @@ module CancellableValueTaskTests = testPropertyWithConfig Expecto.fsCheckConfig "parallelism" <| fun () -> asyncEx { - let! ct = Async.CancellationToken let sequencedList = ResizeArray<_>() let parallelList = ResizeArray<_>() let doOtherStuff (l: ResizeArray<_>) x = cancellableValueTask { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt diff --git a/tests/IcedTasks.Tests/Expect.fs b/tests/IcedTasks.Tests/Expect.fs index 4507cc5..7884c5d 100644 --- a/tests/IcedTasks.Tests/Expect.fs +++ b/tests/IcedTasks.Tests/Expect.fs @@ -4,6 +4,16 @@ open System open System.Threading.Tasks open IcedTasks +module Task = + /// Runs Task.Yield() `max` times. Useful for places where we want the scheduler to asynchronously yield but really fast. + /// We run it max times to ensure it really gets async yielded. + /// Alternative would be Task.Delay but can be slow. + let yieldMany max = + task { + for _ = 0 to max do + do! Task.Yield() + } + module TestHelpers = open System.Threading @@ -141,8 +151,7 @@ type ManualTimeProviderExtensions = task { this.Advance(time) //https://github.com/dotnet/runtime/issues/85326 - do! Task.Yield() - do! Task.Delay(5) + do! Task.yieldMany 10 } diff --git a/tests/IcedTasks.Tests/IcedTasks.Tests.fsproj b/tests/IcedTasks.Tests/IcedTasks.Tests.fsproj index 916f24b..635faec 100644 --- a/tests/IcedTasks.Tests/IcedTasks.Tests.fsproj +++ b/tests/IcedTasks.Tests/IcedTasks.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net8.0;net7.0;net6.0 + net8.0;net6.0 false $(DefineConstants);TEST_NET6_0_OR_GREATER diff --git a/tests/IcedTasks.Tests/PoolingValueTaskTests.fs b/tests/IcedTasks.Tests/PoolingValueTaskTests.fs index c99392c..58558d0 100644 --- a/tests/IcedTasks.Tests/PoolingValueTaskTests.fs +++ b/tests/IcedTasks.Tests/PoolingValueTaskTests.fs @@ -691,7 +691,7 @@ module PoolingValueTaskTests = let doOtherStuff (l: ResizeArray<_>) x = poolingValueTask { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt diff --git a/tests/IcedTasks.Tests/TaskTests.fs b/tests/IcedTasks.Tests/TaskTests.fs index 913b5cc..836a88d 100644 --- a/tests/IcedTasks.Tests/TaskTests.fs +++ b/tests/IcedTasks.Tests/TaskTests.fs @@ -694,7 +694,7 @@ module TaskTests = let doOtherStuff (l: ResizeArray<_>) x = task { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt diff --git a/tests/IcedTasks.Tests/ValueTaskTests.fs b/tests/IcedTasks.Tests/ValueTaskTests.fs index 4144188..3627561 100644 --- a/tests/IcedTasks.Tests/ValueTaskTests.fs +++ b/tests/IcedTasks.Tests/ValueTaskTests.fs @@ -691,7 +691,7 @@ module ValueTaskTests = let doOtherStuff (l: ResizeArray<_>) x = valueTask { l.Add(x) - do! Task.Delay(15) + do! Task.yieldMany 1000 let dt = DateTimeOffset.UtcNow l.Add(x) return dt