diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 232ff081d..36cc13c32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,21 +26,22 @@ jobs: strategy: fail-fast: false matrix: - framework: [net8.0, net9.0] + framework: [net8.0, net9.0, net10.0] os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: ref: ${{ github.event.inputs.ref || github.ref }} - name: Install dotnet SDKs - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v5 with: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Scan for Vulnerabilities shell: bash run: | @@ -57,7 +58,7 @@ jobs: name: publish steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: ref: ${{ github.event.inputs.ref || github.ref }} fetch-depth: 0 @@ -78,11 +79,12 @@ jobs: echo "version=${version}" >> $GITHUB_OUTPUT - name: Install dotnet SDKs - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v5 with: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Dotnet Pack shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40dcf2585..e20a4d5cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,14 +84,14 @@ jobs: strategy: fail-fast: false matrix: - framework: [ net8.0, net9.0 ] + framework: [ net8.0, net9.0, net10.0 ] test: [ Streams, PersistentSubscriptions, Operations, UserManagement, ProjectionManagement, Security, Diagnostics, Misc ] runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 @@ -117,11 +117,12 @@ jobs: password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} - name: Install dotnet SDKs - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v5 with: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Run Tests shell: bash diff --git a/Directory.Build.props b/Directory.Build.props index a22d9632a..bc691b730 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net48;net8.0;net9.0 + net48;net8.0;net9.0;net10.0 true enable enable diff --git a/src/KurrentDB.Client/KurrentDB.Client.csproj b/src/KurrentDB.Client/KurrentDB.Client.csproj index 3cf633376..971799ed0 100644 --- a/src/KurrentDB.Client/KurrentDB.Client.csproj +++ b/src/KurrentDB.Client/KurrentDB.Client.csproj @@ -12,7 +12,6 @@ - @@ -22,6 +21,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -73,4 +74,9 @@ + + + + + diff --git a/src/KurrentDB.Client/PersistentSubscriptions/PersistentSubscription.cs b/src/KurrentDB.Client/PersistentSubscriptions/PersistentSubscription.cs index 4631fe505..5008610e8 100644 --- a/src/KurrentDB.Client/PersistentSubscriptions/PersistentSubscription.cs +++ b/src/KurrentDB.Client/PersistentSubscriptions/PersistentSubscription.cs @@ -28,7 +28,7 @@ internal static async Task Confirm( .Messages .GetAsyncEnumerator(cancellationToken); - var result = await enumerator.MoveNextAsync(cancellationToken).ConfigureAwait(false); + var result = await enumerator.MoveNextAsync().ConfigureAwait(false); return (result, enumerator.Current) switch { (true, PersistentSubscriptionMessage.SubscriptionConfirmation (var subscriptionId)) => @@ -118,7 +118,7 @@ private async Task Subscribe() { _log.LogDebug("Persistent Subscription {subscriptionId} confirmed.", SubscriptionId); try { - while (await _enumerator.MoveNextAsync(_cts.Token).ConfigureAwait(false)) { + while (await _enumerator.MoveNextAsync().ConfigureAwait(false)) { if (_enumerator.Current is not PersistentSubscriptionMessage.Event(var resolvedEvent, var retryCount)) { continue; } diff --git a/test/KurrentDB.Client.Tests.Common/Extensions/AsyncEnumerableExtensions.cs b/test/KurrentDB.Client.Tests.Common/Extensions/AsyncEnumerableExtensions.cs new file mode 100644 index 000000000..2660700a3 --- /dev/null +++ b/test/KurrentDB.Client.Tests.Common/Extensions/AsyncEnumerableExtensions.cs @@ -0,0 +1,10 @@ +// ReSharper disable once CheckNamespace +namespace KurrentDB.Client.Tests; + +public static class AsyncEnumerableExtensions { + public static async Task ForEachAwaitAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken = default) { + await foreach (var element in source.WithCancellation(cancellationToken)) { + await action(element); + } + } +} diff --git a/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToAll/SubscribeToAllTests.cs b/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToAll/SubscribeToAllTests.cs index 4131e3294..7b2ee2cb2 100644 --- a/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToAll/SubscribeToAllTests.cs +++ b/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToAll/SubscribeToAllTests.cs @@ -209,8 +209,8 @@ public async Task connect_with_retries() { // Act var subscription = Fixture.Subscriptions.SubscribeToAll(group, userCredentials: TestCredentials.Root); var retryCount = await subscription.Messages.OfType() - .SelectAwait( - async e => { + .Select( + async (PersistentSubscriptionMessage.Event e, CancellationToken _) => { if (e.RetryCount > 4) { await subscription.Ack(e.ResolvedEvent); } else { @@ -430,8 +430,8 @@ await Fixture.Subscriptions.CreateToAllAsync( } await subscription!.Messages.OfType() - .SelectAwait( - async e => { + .Select( + async (PersistentSubscriptionMessage.Event e, CancellationToken ct) => { await subscription.Ack(e.ResolvedEvent); return e; } diff --git a/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToStream/SubscribeToStreamTests.cs b/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToStream/SubscribeToStreamTests.cs index ba36bef8a..94a17e897 100644 --- a/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToStream/SubscribeToStreamTests.cs +++ b/test/KurrentDB.Client.Tests/PersistentSubscriptions/SubscribeToStream/SubscribeToStreamTests.cs @@ -338,8 +338,8 @@ await Fixture.Subscriptions.CreateToStreamAsync( await using var subscription = Fixture.Subscriptions.SubscribeToStream(stream, group, userCredentials: TestCredentials.Root); await Fixture.Streams.AppendToStreamAsync(stream, StreamState.NoStream, events); var retryCount = await subscription.Messages.OfType() - .SelectAwait( - async e => { + .Select( + async (PersistentSubscriptionMessage.Event e, CancellationToken _) => { if (e.RetryCount > 4) { await subscription.Ack(e.ResolvedEvent); } else {