From c30a2dbd9aa4bad3c106d0ce1b659a541db14c12 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Fri, 22 Nov 2024 16:21:50 -0600 Subject: [PATCH] Update Microsoft.Extensions.Hosting and other CI failure fixes (#370) --- .../Temporalio.Extensions.Hosting.csproj | 2 +- src/Temporalio/Client/ITemporalClientExtensions.cs | 2 +- src/Temporalio/Client/WorkflowHandle.cs | 2 +- src/Temporalio/Worker/WorkflowInstance.cs | 3 ++- src/Temporalio/Worker/WorkflowReplayer.cs | 2 +- tests/Temporalio.SimpleBench/.editorconfig | 3 +++ tests/Temporalio.SimpleBench/Program.cs | 2 +- .../Temporalio.SimpleBench.csproj | 4 ++-- tests/Temporalio.Tests/.editorconfig | 6 ++++++ tests/Temporalio.Tests/Temporalio.Tests.csproj | 12 +++++++++--- 10 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/Temporalio.Extensions.Hosting/Temporalio.Extensions.Hosting.csproj b/src/Temporalio.Extensions.Hosting/Temporalio.Extensions.Hosting.csproj index 2b53da79..92f4fc10 100644 --- a/src/Temporalio.Extensions.Hosting/Temporalio.Extensions.Hosting.csproj +++ b/src/Temporalio.Extensions.Hosting/Temporalio.Extensions.Hosting.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Temporalio/Client/ITemporalClientExtensions.cs b/src/Temporalio/Client/ITemporalClientExtensions.cs index 2beb2d26..d980de3a 100644 --- a/src/Temporalio/Client/ITemporalClientExtensions.cs +++ b/src/Temporalio/Client/ITemporalClientExtensions.cs @@ -150,7 +150,7 @@ public static async IAsyncEnumerable ListWorkflowHistoriesAsync WorkflowListOptions? listOptions = null, WorkflowHistoryEventFetchOptions? historyFetchOptions = null) { - await foreach (var exec in client.ListWorkflowsAsync(query, listOptions)) + await foreach (var exec in client.ListWorkflowsAsync(query, listOptions).ConfigureAwait(false)) { yield return await client.GetWorkflowHandle( exec.Id, exec.RunId).FetchHistoryAsync(historyFetchOptions).ConfigureAwait(false); diff --git a/src/Temporalio/Client/WorkflowHandle.cs b/src/Temporalio/Client/WorkflowHandle.cs index 99cb0488..f55fa73a 100644 --- a/src/Temporalio/Client/WorkflowHandle.cs +++ b/src/Temporalio/Client/WorkflowHandle.cs @@ -545,7 +545,7 @@ public async Task FetchHistoryAsync( }; } var events = new List(); - await foreach (var evt in FetchHistoryEventsAsync(eventFetchOptions)) + await foreach (var evt in FetchHistoryEventsAsync(eventFetchOptions).ConfigureAwait(false)) { events.Add(evt); } diff --git a/src/Temporalio/Worker/WorkflowInstance.cs b/src/Temporalio/Worker/WorkflowInstance.cs index 7cbed113..dfafc16d 100644 --- a/src/Temporalio/Worker/WorkflowInstance.cs +++ b/src/Temporalio/Worker/WorkflowInstance.cs @@ -9,6 +9,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Google.Protobuf.Collections; using Microsoft.Extensions.Logging; using Temporalio.Api.Common.V1; using Temporalio.Bridge.Api.ActivityResult; @@ -1360,7 +1361,7 @@ private void OnUpdateDefinitionAdded(string name, WorkflowUpdateDefinition defn) private object?[] DecodeArgs( MethodInfo method, - IReadOnlyCollection payloads, + RepeatedField payloads, string itemName, bool dynamic, string? dynamicArgPrepend = null) diff --git a/src/Temporalio/Worker/WorkflowReplayer.cs b/src/Temporalio/Worker/WorkflowReplayer.cs index 6ff11ac2..3e7dafa9 100644 --- a/src/Temporalio/Worker/WorkflowReplayer.cs +++ b/src/Temporalio/Worker/WorkflowReplayer.cs @@ -112,7 +112,7 @@ public async IAsyncEnumerable ReplayWorkflowsAsync( try { var results = new List(); - await foreach (var history in histories) + await foreach (var history in histories.ConfigureAwait(false)) { // Run until complete or cancelled, throw if cancelled, yield if complete var runTask = runner.RunWorkflowAsync(history); diff --git a/tests/Temporalio.SimpleBench/.editorconfig b/tests/Temporalio.SimpleBench/.editorconfig index 0475ffc4..2e92bbeb 100644 --- a/tests/Temporalio.SimpleBench/.editorconfig +++ b/tests/Temporalio.SimpleBench/.editorconfig @@ -4,6 +4,9 @@ # Please keep in alphabetical order by field. +# Don't care about item visibility +dotnet_diagnostic.CA1515.severity = none + # Some versions can't tell implicit Program shouldn't need to be instantiated dotnet_diagnostic.CA1812.severity = none diff --git a/tests/Temporalio.SimpleBench/Program.cs b/tests/Temporalio.SimpleBench/Program.cs index b9712cfb..2bdb9657 100644 --- a/tests/Temporalio.SimpleBench/Program.cs +++ b/tests/Temporalio.SimpleBench/Program.cs @@ -62,7 +62,7 @@ MaxConcurrentActivities = maxConcurrent, }. AddActivity(BenchActivities.BenchActivity). - AddWorkflow(typeof(BenchWorkflow))); + AddWorkflow()); using var cancelSource = CancellationTokenSource.CreateLinkedTokenSource(ctx.GetCancellationToken()); var workerTask = Task.Run(() => worker.ExecuteAsync(cancelSource.Token)); diff --git a/tests/Temporalio.SimpleBench/Temporalio.SimpleBench.csproj b/tests/Temporalio.SimpleBench/Temporalio.SimpleBench.csproj index 1dc4eee1..4b69ca33 100644 --- a/tests/Temporalio.SimpleBench/Temporalio.SimpleBench.csproj +++ b/tests/Temporalio.SimpleBench/Temporalio.SimpleBench.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/tests/Temporalio.Tests/.editorconfig b/tests/Temporalio.Tests/.editorconfig index 840985ab..113e9eef 100644 --- a/tests/Temporalio.Tests/.editorconfig +++ b/tests/Temporalio.Tests/.editorconfig @@ -13,6 +13,9 @@ dotnet_diagnostic.CA1024.severity = none # We use empty interfaces in some tests dotnet_diagnostic.CA1040.severity = none +# Don't care about test item visibility +dotnet_diagnostic.CA1515.severity = none + # Tests can have underscores in method names dotnet_diagnostic.CA1707.severity = none @@ -31,6 +34,9 @@ dotnet_diagnostic.CA2007.severity = none # Do not need task scheduler for workflows dotnet_diagnostic.CA2008.severity = none +# Testing specific overloads is ok +dotnet_diagnostic.CA2263.severity = none + # Workflow randomness is intentionally deterministic dotnet_diagnostic.CA5394.severity = none diff --git a/tests/Temporalio.Tests/Temporalio.Tests.csproj b/tests/Temporalio.Tests/Temporalio.Tests.csproj index edf151fb..c36fd619 100644 --- a/tests/Temporalio.Tests/Temporalio.Tests.csproj +++ b/tests/Temporalio.Tests/Temporalio.Tests.csproj @@ -12,15 +12,21 @@ - - + + - + + + + + + +