From 486aed66f54ab6818aeab545a980ad423489b908 Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 16 Apr 2023 09:43:44 +0200 Subject: [PATCH 1/4] add tests --- src/Proto.Actor/Future/SharedFuture.cs | 10 ++++++- src/Proto.Actor/PID.cs | 10 ++++++- .../Futures/SharedFutureBugTests.cs | 28 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs diff --git a/src/Proto.Actor/Future/SharedFuture.cs b/src/Proto.Actor/Future/SharedFuture.cs index 964e4aee4b..df9664493c 100644 --- a/src/Proto.Actor/Future/SharedFuture.cs +++ b/src/Proto.Actor/Future/SharedFuture.cs @@ -104,7 +104,15 @@ public void Dispose() Interlocked.Increment(ref _createdRequests); _onStarted?.Invoke(); - return new SharedFutureHandle(this, pid, requestSlot.CompletionSource!); + var cs = requestSlot.CompletionSource!; + + // //TODO: can this happen? + // if (cs.Task.IsCanceled) + // { + // throw new Exception("SharedFuture bug, Task is canceled"); + // } + + return new SharedFutureHandle(this, pid, cs); } protected internal override void SendUserMessage(PID pid, object message) diff --git a/src/Proto.Actor/PID.cs b/src/Proto.Actor/PID.cs index ecc9d66e26..c2e14878d4 100644 --- a/src/Proto.Actor/PID.cs +++ b/src/Proto.Actor/PID.cs @@ -33,7 +33,15 @@ internal PID(string address, string id, Process process) : this(address, id) internal Process? CurrentRef { get; private set; } - public string ToDiagnosticString() => $"{Address}/{Id}"; + public string ToDiagnosticString() + { + if (RequestId > 0) + { + return $"{Address}/{Id}:{RequestId}"; + } + + return $"{Address}/{Id}"; + } /// /// Creates a new PID instance from address and identifier. diff --git a/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs new file mode 100644 index 0000000000..2738ef78f5 --- /dev/null +++ b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using FluentAssertions; +using Xunit; + +namespace Proto.Tests; + +public class SharedFutureBugTests +{ + [Fact] + public async Task Should_get_unique_future() + { + var system = new ActorSystem(); + await using var _ = system; + var context = system.Root; + + var count = 100_000; + var hashSet = new HashSet(); + for (int i = 0; i < count; i++) + { + var f = context.GetFuture(); + var s = f.Pid.ToDiagnosticString(); + hashSet.Add(s); + } + + hashSet.Count.Should().Be(count); + } +} \ No newline at end of file From d1f4d7609259c60a648ff22aceaf5dbdea405320 Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 16 Apr 2023 09:57:31 +0200 Subject: [PATCH 2/4] fix ugly code --- .../Diagnostics/DiagnosticsTests.cs | 6 +-- .../Extensions/ExtensionTests.cs | 3 +- .../Proto.Actor.Tests/Futures/FutureTests.cs | 15 ++---- .../Futures/SharedFutureBugTests.cs | 3 +- .../Headers/MessageHeaderTests.cs | 6 +-- .../Router/BroadcastGroupTests.cs | 24 ++++------ .../Router/ConsistentHashGroupTests.cs | 30 ++++-------- tests/Proto.Actor.Tests/StoreTests.cs | 3 +- .../SupervisionTests_AllForOne.cs | 15 ++---- .../SupervisionTests_OneForOne.cs | 33 +++++-------- tests/Proto.Actor.Tests/WatchTests.cs | 6 +-- .../ExamplePersistentActorTests.cs | 48 +++++++------------ .../ForcedSerializationTests.cs | 6 +-- 13 files changed, 66 insertions(+), 132 deletions(-) diff --git a/tests/Proto.Actor.Tests/Diagnostics/DiagnosticsTests.cs b/tests/Proto.Actor.Tests/Diagnostics/DiagnosticsTests.cs index 030084a0a3..20c173b97a 100644 --- a/tests/Proto.Actor.Tests/Diagnostics/DiagnosticsTests.cs +++ b/tests/Proto.Actor.Tests/Diagnostics/DiagnosticsTests.cs @@ -23,8 +23,7 @@ public class DiagnosticsTests [Fact] public async Task CanListPidsInProcessRegistry() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var props = Props.FromProducer(() => new MyDiagnosticsActor()); @@ -41,8 +40,7 @@ public async Task CanListPidsInProcessRegistry() [Fact] public async Task CanGetDiagnosticsStringFromActorDiagnostics() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var props = Props.FromProducer(() => new MyDiagnosticsActor()); diff --git a/tests/Proto.Actor.Tests/Extensions/ExtensionTests.cs b/tests/Proto.Actor.Tests/Extensions/ExtensionTests.cs index c3ae904950..e7b3705037 100644 --- a/tests/Proto.Actor.Tests/Extensions/ExtensionTests.cs +++ b/tests/Proto.Actor.Tests/Extensions/ExtensionTests.cs @@ -23,8 +23,7 @@ public void ExtensionsGetOwnId() => [Fact] public async Task CanGetExtension() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); system.Extensions.Register(new ExtensionA { diff --git a/tests/Proto.Actor.Tests/Futures/FutureTests.cs b/tests/Proto.Actor.Tests/Futures/FutureTests.cs index b1d89dda3e..841cac7a30 100644 --- a/tests/Proto.Actor.Tests/Futures/FutureTests.cs +++ b/tests/Proto.Actor.Tests/Futures/FutureTests.cs @@ -17,8 +17,7 @@ public FutureTests(ITestOutputHelper output) [Fact] public async Task Given_Actor_When_AwaitRequestAsync_Should_ReturnReply() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var pid = context.Spawn(Props.FromFunc(ctx => @@ -41,8 +40,7 @@ public async Task Given_Actor_When_AwaitRequestAsync_Should_ReturnReply() [Fact] public async Task Given_Actor_When_AwaitContextRequestAsync_Should_GetReply() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var pid1 = context.Spawn(Props.FromFunc(ctx => @@ -76,8 +74,7 @@ public async Task Given_Actor_When_AwaitContextRequestAsync_Should_GetReply() [Fact] public async Task Given_Actor_When_ReplyIsNull_Should_Return() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var pid = context.Spawn(Props.FromFunc(ctx => @@ -101,8 +98,7 @@ public async Task Given_Actor_When_ReplyIsNull_Should_Return() public void TestInATask() => SafeTask.Run(async () => { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var pid = context.Spawn(Props.FromFunc(ctx => @@ -134,8 +130,7 @@ public void TestInATask() => public void TestInATaskIndirect() => Task.Run(async () => { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var replier = context.Spawn(Props.FromFunc(ctx => diff --git a/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs index 2738ef78f5..47b690aca7 100644 --- a/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs +++ b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs @@ -10,8 +10,7 @@ public class SharedFutureBugTests [Fact] public async Task Should_get_unique_future() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var count = 100_000; diff --git a/tests/Proto.Actor.Tests/Headers/MessageHeaderTests.cs b/tests/Proto.Actor.Tests/Headers/MessageHeaderTests.cs index 3371d05b4f..def1004736 100644 --- a/tests/Proto.Actor.Tests/Headers/MessageHeaderTests.cs +++ b/tests/Proto.Actor.Tests/Headers/MessageHeaderTests.cs @@ -100,8 +100,7 @@ Sender PropagateHeaders(Sender next) => [Fact] public async Task Actors_can_reply_with_headers() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var echo = Props.FromFunc(ctx => { @@ -127,8 +126,7 @@ public async Task Actors_can_reply_with_headers() [Fact] public async Task RequestAsync_honors_message_envelopes() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var echo = Props.FromFunc(ctx => { diff --git a/tests/Proto.Actor.Tests/Router/BroadcastGroupTests.cs b/tests/Proto.Actor.Tests/Router/BroadcastGroupTests.cs index 81cf9d74a2..a1aafd1692 100644 --- a/tests/Proto.Actor.Tests/Router/BroadcastGroupTests.cs +++ b/tests/Proto.Actor.Tests/Router/BroadcastGroupTests.cs @@ -14,8 +14,7 @@ public class BroadcastGroupTests [Fact] public async Task BroadcastGroupRouter_AllRouteesReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); @@ -29,8 +28,7 @@ public async Task BroadcastGroupRouter_AllRouteesReceiveMessages() [Fact] public async Task BroadcastGroupRouter_WhenOneRouteeIsStopped_AllOtherRouteesReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); @@ -44,8 +42,7 @@ public async Task BroadcastGroupRouter_WhenOneRouteeIsStopped_AllOtherRouteesRec [Fact] public async Task BroadcastGroupRouter_WhenOneRouteeIsSlow_AllOtherRouteesReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); @@ -59,8 +56,7 @@ public async Task BroadcastGroupRouter_WhenOneRouteeIsSlow_AllOtherRouteesReceiv [Fact] public async Task BroadcastGroupRouter_RouteesCanBeRemoved() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); @@ -75,8 +71,7 @@ public async Task BroadcastGroupRouter_RouteesCanBeRemoved() [Fact] public async Task BroadcastGroupRouter_RouteesCanBeAdded() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); var routee4 = system.Root.Spawn(MyActorProps); @@ -92,8 +87,7 @@ public async Task BroadcastGroupRouter_RouteesCanBeAdded() [Fact] public async Task BroadcastGroupRouter_RemovedRouteesNoLongerReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); @@ -109,8 +103,7 @@ public async Task BroadcastGroupRouter_RemovedRouteesNoLongerReceiveMessages() [Fact] public async Task BroadcastGroupRouter_AddedRouteesReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); var routee4 = system.Root.Spawn(MyActorProps); @@ -126,8 +119,7 @@ public async Task BroadcastGroupRouter_AddedRouteesReceiveMessages() [Fact] public async Task BroadcastGroupRouter_AllRouteesReceiveRouterBroadcastMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateBroadcastGroupRouterWith3Routees(system); diff --git a/tests/Proto.Actor.Tests/Router/ConsistentHashGroupTests.cs b/tests/Proto.Actor.Tests/Router/ConsistentHashGroupTests.cs index cb41090c98..0e34f6409e 100644 --- a/tests/Proto.Actor.Tests/Router/ConsistentHashGroupTests.cs +++ b/tests/Proto.Actor.Tests/Router/ConsistentHashGroupTests.cs @@ -17,8 +17,7 @@ public class ConsistentHashGroupTests [Fact] public async Task ConsistentHashGroupRouter_MessageWithSameHashAlwaysGoesToSameRoutee() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); @@ -34,8 +33,7 @@ public async Task ConsistentHashGroupRouter_MessageWithSameHashAlwaysGoesToSameR [Fact] public async Task ConsistentHashGroupRouter_with_MessageHasherFunc_MessageWithSameHashAlwaysGoesToSameRoutee() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system, x => x.ToString()!); @@ -51,8 +49,7 @@ public async Task ConsistentHashGroupRouter_with_MessageHasherFunc_MessageWithSa [Fact] public async Task ConsistentHashGroupRouter_MessagesWithDifferentHashesGoToDifferentRoutees() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); @@ -68,8 +65,7 @@ public async Task ConsistentHashGroupRouter_MessagesWithDifferentHashesGoToDiffe [Fact] public async Task ConsistentHashGroupRouter_MessageWithSameHashAlwaysGoesToSameRoutee_EvenWhenNewRouteeAdded() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); @@ -86,8 +82,7 @@ public async Task ConsistentHashGroupRouter_MessageWithSameHashAlwaysGoesToSameR [Fact] public async Task ConsistentHashGroupRouter_RouteesCanBeRemoved() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); @@ -102,8 +97,7 @@ public async Task ConsistentHashGroupRouter_RouteesCanBeRemoved() [Fact] public async Task ConsistentHashGroupRouter_RouteesCanBeAdded() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); var routee4 = system.Root.Spawn(MyActorProps); @@ -119,8 +113,7 @@ public async Task ConsistentHashGroupRouter_RouteesCanBeAdded() [Fact] public async Task ConsistentHashGroupRouter_RemovedRouteesNoLongerReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, _, _) = CreateRouterWith3Routees(system); @@ -132,8 +125,7 @@ public async Task ConsistentHashGroupRouter_RemovedRouteesNoLongerReceiveMessage [Fact] public async Task ConsistentHashGroupRouter_AddedRouteesReceiveMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, _, _, _) = CreateRouterWith3Routees(system); var routee4 = system.Root.Spawn(MyActorProps); @@ -145,8 +137,7 @@ public async Task ConsistentHashGroupRouter_AddedRouteesReceiveMessages() [Fact] public async Task ConsistentHashGroupRouter_MessageIsReassignedWhenRouteeRemoved() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, _) = CreateRouterWith3Routees(system); @@ -164,8 +155,7 @@ public async Task ConsistentHashGroupRouter_MessageIsReassignedWhenRouteeRemoved [Fact] public async Task ConsistentHashGroupRouter_AllRouteesReceiveRouterBroadcastMessages() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var (router, routee1, routee2, routee3) = CreateRouterWith3Routees(system); diff --git a/tests/Proto.Actor.Tests/StoreTests.cs b/tests/Proto.Actor.Tests/StoreTests.cs index 417b8fa295..4e062d1f3d 100644 --- a/tests/Proto.Actor.Tests/StoreTests.cs +++ b/tests/Proto.Actor.Tests/StoreTests.cs @@ -8,8 +8,7 @@ public class StoreTests [Fact] public async Task Given_RootContextStore_SetAndGetCustomObject() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var toStore = new StoreType(); diff --git a/tests/Proto.Actor.Tests/SupervisionTests_AllForOne.cs b/tests/Proto.Actor.Tests/SupervisionTests_AllForOne.cs index f2ce2ae609..503aaba711 100644 --- a/tests/Proto.Actor.Tests/SupervisionTests_AllForOne.cs +++ b/tests/Proto.Actor.Tests/SupervisionTests_AllForOne.cs @@ -14,8 +14,7 @@ public class SupervisionTestsAllForOne [Fact] public async Task AllForOneStrategy_Should_ResumeChildOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var child1MailboxStats = new TestMailboxStatistics(msg => msg is ResumeMailbox); @@ -45,8 +44,7 @@ public async Task AllForOneStrategy_Should_ResumeChildOnFailure() [Fact] public async Task AllForOneStrategy_Should_StopAllChildrenOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var child1MailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -77,8 +75,7 @@ public async Task AllForOneStrategy_Should_StopAllChildrenOnFailure() [Fact] public async Task AllForOneStrategy_Should_RestartAllChildrenOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var child1MailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -109,8 +106,7 @@ public async Task AllForOneStrategy_Should_RestartAllChildrenOnFailure() [Fact] public async Task AllForOneStrategy_Should_PassExceptionOnRestart() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var child1MailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -141,8 +137,7 @@ public async Task AllForOneStrategy_Should_PassExceptionOnRestart() [Fact] public async Task AllForOneStrategy_Should_EscalateFailureToParent() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var parentMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); diff --git a/tests/Proto.Actor.Tests/SupervisionTests_OneForOne.cs b/tests/Proto.Actor.Tests/SupervisionTests_OneForOne.cs index 7e286be4d2..46b4a7415c 100644 --- a/tests/Proto.Actor.Tests/SupervisionTests_OneForOne.cs +++ b/tests/Proto.Actor.Tests/SupervisionTests_OneForOne.cs @@ -15,8 +15,7 @@ public class SupervisionTestsOneForOne [Fact] public async Task OneForOneStrategy_Should_ResumeChildOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is ResumeMailbox); @@ -40,8 +39,7 @@ public async Task OneForOneStrategy_Should_ResumeChildOnFailure() [Fact] public async Task OneForOneStrategy_Should_StopChildOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -65,8 +63,7 @@ public async Task OneForOneStrategy_Should_StopChildOnFailure() [Fact] public async Task OneForOneStrategy_Should_RestartChildOnFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -91,8 +88,7 @@ public async Task OneForOneStrategy_Should_RestartChildOnFailure() public async Task OneForOneStrategy_WhenRestartedLessThanMaximumAllowedRetriesWithinSpecifiedTimePeriod_ShouldNotStopChild() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -129,8 +125,7 @@ public async Task public async Task OneForOneStrategy_WhenRestartedMoreThanMaximumAllowedRetriesWithinSpecifiedTimePeriod_ShouldStopChild() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -160,8 +155,7 @@ public async Task [Fact] public async Task OneForOneStrategy_Should_PassExceptionOnRestart() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -185,8 +179,7 @@ public async Task OneForOneStrategy_Should_PassExceptionOnRestart() [Fact] public async Task OneForOneStrategy_Should_StopChildWhenRestartLimitReached() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -211,8 +204,7 @@ public async Task OneForOneStrategy_Should_StopChildWhenRestartLimitReached() [Fact] public async Task OneForOneStrategy_WhenEscalateDirectiveWithoutGrandparent_ShouldRevertToDefaultDirective() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var parentMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -249,8 +241,7 @@ public async Task OneForOneStrategy_WhenEscalateDirectiveWithoutGrandparent_Shou [Fact] public async Task OneForOneStrategy_Should_EscalateFailureToParent() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var parentMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -273,8 +264,7 @@ public async Task OneForOneStrategy_Should_EscalateFailureToParent() [Fact] public async Task OneForOneStrategy_Should_StopChildOnFailureWhenStarted() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var childMailboxStats = new TestMailboxStatistics(msg => msg is Stopped); @@ -296,8 +286,7 @@ public async Task OneForOneStrategy_Should_StopChildOnFailureWhenStarted() [Fact] public async Task OneForOneStrategy_Should_RestartParentOnEscalateFailure() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var parentMailboxStats = new TestMailboxStatistics(msg => msg is Restart); diff --git a/tests/Proto.Actor.Tests/WatchTests.cs b/tests/Proto.Actor.Tests/WatchTests.cs index ac5154ed90..d552579e35 100644 --- a/tests/Proto.Actor.Tests/WatchTests.cs +++ b/tests/Proto.Actor.Tests/WatchTests.cs @@ -11,8 +11,7 @@ public class WatchTests [Fact] public async Task MultipleStopsTriggerSingleTerminated() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; long counter = 0; @@ -58,8 +57,7 @@ public async Task MultipleStopsTriggerSingleTerminated() [Fact] public async Task CanWatchLocalActors() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var watchee = context.Spawn(Props.FromProducer(() => new DoNothingActor()) diff --git a/tests/Proto.Persistence.Tests/ExamplePersistentActorTests.cs b/tests/Proto.Persistence.Tests/ExamplePersistentActorTests.cs index 5397ec3f14..48b92cb4ac 100644 --- a/tests/Proto.Persistence.Tests/ExamplePersistentActorTests.cs +++ b/tests/Proto.Persistence.Tests/ExamplePersistentActorTests.cs @@ -13,8 +13,7 @@ public class ExamplePersistentActorTests [Fact] public async Task EventsAreSavedToPersistence() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, actorId, providerState) = CreateTestActor(context); @@ -32,8 +31,7 @@ await providerState [Fact] public async Task SnapshotsAreSavedToPersistence() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, actorId, providerState) = CreateTestActor(context); @@ -47,8 +45,7 @@ public async Task SnapshotsAreSavedToPersistence() [Fact] public async Task EventsCanBeDeleted() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, actorId, providerState) = CreateTestActor(context); @@ -63,8 +60,7 @@ public async Task EventsCanBeDeleted() [Fact] public async Task SnapshotsCanBeDeleted() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, actorId, providerState) = CreateTestActor(context); @@ -78,8 +74,7 @@ public async Task SnapshotsCanBeDeleted() [Fact] public async Task GivenEventsOnly_StateIsRestoredFromEvents() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, _, _) = CreateTestActor(context); @@ -92,8 +87,7 @@ public async Task GivenEventsOnly_StateIsRestoredFromEvents() [Fact] public async Task GivenASnapshotOnly_StateIsRestoredFromTheSnapshot() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, actorId, providerState) = CreateTestActor(context); @@ -105,8 +99,7 @@ public async Task GivenASnapshotOnly_StateIsRestoredFromTheSnapshot() [Fact] public async Task GivenEventsThenASnapshot_StateShouldBeRestoredFromTheSnapshot() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, _, _) = CreateTestActor(context); @@ -121,8 +114,7 @@ public async Task GivenEventsThenASnapshot_StateShouldBeRestoredFromTheSnapshot( [Fact] public async Task GivenASnapshotAndSubsequentEvents_StateShouldBeRestoredFromSnapshotAndSubsequentEvents() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, _, _) = CreateTestActor(context); @@ -139,8 +131,7 @@ public async Task GivenASnapshotAndSubsequentEvents_StateShouldBeRestoredFromSna [Fact] public async Task GivenMultipleSnapshots_StateIsRestoredFromMostRecentSnapshot() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, actorId, providerState) = CreateTestActor(context); @@ -157,8 +148,7 @@ public async Task GivenMultipleSnapshots_StateIsRestoredFromMostRecentSnapshot() [Fact] public async Task GivenMultipleSnapshots_DeleteSnapshotObeysIndex() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, actorId, providerState) = CreateTestActor(context); @@ -177,8 +167,7 @@ public async Task GivenMultipleSnapshots_DeleteSnapshotObeysIndex() [Fact] public async Task GivenASnapshotAndEvents_WhenSnapshotDeleted_StateShouldBeRestoredFromEvents() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, actorId, providerState) = CreateTestActor(context); @@ -197,8 +186,7 @@ public async Task GivenASnapshotAndEvents_WhenSnapshotDeleted_StateShouldBeResto [Fact] public async Task Index_IncrementsOnEventsSaved() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, _, _) = CreateTestActor(context); @@ -214,8 +202,7 @@ public async Task Index_IncrementsOnEventsSaved() [Fact] public async Task Index_IsIncrementedByTakingASnapshot() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, _, _) = CreateTestActor(context); @@ -230,8 +217,7 @@ public async Task Index_IsIncrementedByTakingASnapshot() [Fact] public async Task Index_IsCorrectAfterRecovery() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, props, _, _) = CreateTestActor(context); @@ -250,8 +236,7 @@ public async Task Index_IsCorrectAfterRecovery() [Fact] public async Task GivenEvents_CanReplayFromStartIndexToEndIndex() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var (pid, _, actorId, providerState) = CreateTestActor(context); @@ -270,8 +255,7 @@ public async Task GivenEvents_CanReplayFromStartIndexToEndIndex() [Fact] public async Task CanUseSeparateStores() { - var system = new ActorSystem(); - await using var _ = system; + await using var system = new ActorSystem(); var context = system.Root; var actorId = Guid.NewGuid().ToString(); diff --git a/tests/Proto.Remote.Tests/ForcedSerializationTests.cs b/tests/Proto.Remote.Tests/ForcedSerializationTests.cs index 1a7f18b4ba..cdebadbc94 100644 --- a/tests/Proto.Remote.Tests/ForcedSerializationTests.cs +++ b/tests/Proto.Remote.Tests/ForcedSerializationTests.cs @@ -133,8 +133,7 @@ public void It_should_not_serialize_if_predicate_prevents_it() [Fact] public async Task It_preserves_headers() { - var system = new ActorSystem(ActorSystemConfig.Setup()); - await using var _ = system; + await using var system = new ActorSystem(); system.Extensions.Register(new Serialization()); var pid = system.Root.Spawn(_receivingActorProps); @@ -151,8 +150,7 @@ public async Task It_preserves_headers() [Fact] public async Task It_preserves_sender() { - var system = new ActorSystem(ActorSystemConfig.Setup()); - await using var _ = system; + await using var system = new ActorSystem(); system.Extensions.Register(new Serialization()); var pid = system.Root.Spawn(_receivingActorProps); From beb741b636b52ece252a0ea5f0e4c1f6b43198cc Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 16 Apr 2023 11:34:52 +0200 Subject: [PATCH 3/4] remove netstandard --- .github/workflows/build-dev.yml | 1 - .github/workflows/pull-request.yml | 1 - benchmarks/RemoteBenchmark/Node2/Program.cs | 4 -- src/Proto.Actor/Future/SharedFuture.cs | 2 +- src/Proto.Actor/Mailbox/Mailbox.cs | 18 ++---- src/Proto.Actor/Proto.Actor.csproj | 2 +- .../Proto.Cluster.AmazonECS.csproj | 2 +- .../Proto.Cluster.AzureContainerApps.csproj | 2 +- .../Proto.Cluster.Consul.csproj | 2 +- .../Proto.Cluster.Identity.MongoDb.csproj | 2 +- .../Proto.Cluster.Identity.Redis.csproj | 2 +- .../Proto.Cluster.Kubernetes.csproj | 2 +- .../Proto.Cluster.TestProvider.csproj | 2 +- src/Proto.Cluster/DefaultClusterContext.cs | 59 +------------------ src/Proto.Cluster/Proto.Cluster.csproj | 2 +- .../Proto.OpenTelemetry.csproj | 2 +- .../Proto.Persistence.Couchbase.csproj | 2 +- .../Proto.Persistence.DynamoDB.csproj | 2 +- .../Proto.Persistence.Marten.csproj | 2 +- .../Proto.Persistence.MongoDB.csproj | 2 +- .../Proto.Persistence.RavenDB.csproj | 2 +- .../Proto.Persistence.SqlServer.csproj | 2 +- .../Proto.Persistence.Sqlite.csproj | 2 +- .../Proto.Persistence.csproj | 2 +- src/Proto.Remote/Proto.Remote.csproj | 2 +- src/Proto.TestKit/Proto.TestKit.csproj | 2 +- .../Futures/SharedFutureBugTests.cs | 1 + .../Proto.Actor.Tests.csproj | 2 +- .../Proto.Cluster.CodeGen.Tests.csproj | 2 +- .../Proto.Cluster.Identity.Tests.csproj | 2 +- .../Proto.Cluster.MongoIdentity.Tests.csproj | 2 +- ...oto.Cluster.PartitionIdentity.Tests.csproj | 2 +- .../Proto.Cluster.PubSub.Tests.csproj | 2 +- .../Proto.Cluster.RedisIdentity.Tests.csproj | 2 +- tests/Proto.Cluster.Tests/ClusterFixture.cs | 3 - .../Proto.Cluster.Tests.csproj | 2 +- .../Proto.OpenTelemetry.Tests.csproj | 2 +- .../Proto.Persistence.Tests.csproj | 2 +- .../Proto.Remote.Tests.Messages.csproj | 2 +- .../Proto.Remote.Tests.csproj | 2 +- .../Proto.TestFixtures.csproj | 2 +- 41 files changed, 40 insertions(+), 115 deletions(-) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index f5e027498c..9545063f08 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -28,7 +28,6 @@ jobs: dotnet: - net7.0 - net6.0 - - netcoreapp3.1 test: - "tests/Proto.Cluster.Tests/*.csproj" - "tests/Proto.Cluster.PartitionIdentity.Tests/*.csproj" diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 79f6ff9f8a..36e6b603c4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -53,7 +53,6 @@ jobs: dotnet: - net7.0 - net6.0 - - netcoreapp3.1 test: - "tests/Proto.Cluster.Tests/*.csproj" - "tests/Proto.Cluster.PartitionIdentity.Tests/*.csproj" diff --git a/benchmarks/RemoteBenchmark/Node2/Program.cs b/benchmarks/RemoteBenchmark/Node2/Program.cs index 83cc921cb8..7ca663ca9a 100644 --- a/benchmarks/RemoteBenchmark/Node2/Program.cs +++ b/benchmarks/RemoteBenchmark/Node2/Program.cs @@ -57,10 +57,6 @@ private static async Task Main() ) ); -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif - Console.WriteLine("Enter Advertised Host (Default = 127.0.0.1)"); var advertisedHost = Console.ReadLine().Trim(); diff --git a/src/Proto.Actor/Future/SharedFuture.cs b/src/Proto.Actor/Future/SharedFuture.cs index df9664493c..06d7bc3835 100644 --- a/src/Proto.Actor/Future/SharedFuture.cs +++ b/src/Proto.Actor/Future/SharedFuture.cs @@ -105,7 +105,7 @@ public void Dispose() _onStarted?.Invoke(); var cs = requestSlot.CompletionSource!; - + // //TODO: can this happen? // if (cs.Task.IsCanceled) // { diff --git a/src/Proto.Actor/Mailbox/Mailbox.cs b/src/Proto.Actor/Mailbox/Mailbox.cs index f73e0d90c7..6894fa368b 100644 --- a/src/Proto.Actor/Mailbox/Mailbox.cs +++ b/src/Proto.Actor/Mailbox/Mailbox.cs @@ -46,10 +46,8 @@ public static IMailbox Create(params IMailboxStatistics[] stats) => new DefaultMailbox(new LockingUnboundedMailboxQueue(4), new UnboundedMailboxQueue(), stats); } -public sealed class DefaultMailbox : IMailbox -#if NET5_0_OR_GREATER - , IThreadPoolWorkItem -#endif +public sealed class DefaultMailbox : IMailbox, IThreadPoolWorkItem + { private readonly IMailboxStatistics[] _stats; private readonly IMailboxQueue _systemMessages; @@ -319,17 +317,9 @@ private void Schedule() } } } - -#if NET5_0_OR_GREATER + public void Execute() => _ = RunAsync(this); -#else - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void RunWrapper(object state) - { - var y = (DefaultMailbox)state; - RunAsync(y); - } -#endif + } /// diff --git a/src/Proto.Actor/Proto.Actor.csproj b/src/Proto.Actor/Proto.Actor.csproj index 08fcb84517..b698e787d0 100644 --- a/src/Proto.Actor/Proto.Actor.csproj +++ b/src/Proto.Actor/Proto.Actor.csproj @@ -5,7 +5,7 @@ enable true 10 - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.AmazonECS/Proto.Cluster.AmazonECS.csproj b/src/Proto.Cluster.AmazonECS/Proto.Cluster.AmazonECS.csproj index c44b0156a6..20bbf79dee 100644 --- a/src/Proto.Cluster.AmazonECS/Proto.Cluster.AmazonECS.csproj +++ b/src/Proto.Cluster.AmazonECS/Proto.Cluster.AmazonECS.csproj @@ -2,7 +2,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.AzureContainerApps/Proto.Cluster.AzureContainerApps.csproj b/src/Proto.Cluster.AzureContainerApps/Proto.Cluster.AzureContainerApps.csproj index 5b8afce4cb..343500e567 100644 --- a/src/Proto.Cluster.AzureContainerApps/Proto.Cluster.AzureContainerApps.csproj +++ b/src/Proto.Cluster.AzureContainerApps/Proto.Cluster.AzureContainerApps.csproj @@ -1,7 +1,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.Consul/Proto.Cluster.Consul.csproj b/src/Proto.Cluster.Consul/Proto.Cluster.Consul.csproj index 0a8f0d56b3..551600f354 100644 --- a/src/Proto.Cluster.Consul/Proto.Cluster.Consul.csproj +++ b/src/Proto.Cluster.Consul/Proto.Cluster.Consul.csproj @@ -1,7 +1,7 @@  10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.Identity.MongoDb/Proto.Cluster.Identity.MongoDb.csproj b/src/Proto.Cluster.Identity.MongoDb/Proto.Cluster.Identity.MongoDb.csproj index 1d98ff9e42..c6e0e2ca7d 100644 --- a/src/Proto.Cluster.Identity.MongoDb/Proto.Cluster.Identity.MongoDb.csproj +++ b/src/Proto.Cluster.Identity.MongoDb/Proto.Cluster.Identity.MongoDb.csproj @@ -2,7 +2,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 enable diff --git a/src/Proto.Cluster.Identity.Redis/Proto.Cluster.Identity.Redis.csproj b/src/Proto.Cluster.Identity.Redis/Proto.Cluster.Identity.Redis.csproj index 802dbb9871..b7ed22413a 100644 --- a/src/Proto.Cluster.Identity.Redis/Proto.Cluster.Identity.Redis.csproj +++ b/src/Proto.Cluster.Identity.Redis/Proto.Cluster.Identity.Redis.csproj @@ -3,7 +3,7 @@ 10 enable - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.Kubernetes/Proto.Cluster.Kubernetes.csproj b/src/Proto.Cluster.Kubernetes/Proto.Cluster.Kubernetes.csproj index c5ac4f5634..b91c099b1e 100644 --- a/src/Proto.Cluster.Kubernetes/Proto.Cluster.Kubernetes.csproj +++ b/src/Proto.Cluster.Kubernetes/Proto.Cluster.Kubernetes.csproj @@ -2,7 +2,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster.TestProvider/Proto.Cluster.TestProvider.csproj b/src/Proto.Cluster.TestProvider/Proto.Cluster.TestProvider.csproj index 59510de853..6f782065f1 100644 --- a/src/Proto.Cluster.TestProvider/Proto.Cluster.TestProvider.csproj +++ b/src/Proto.Cluster.TestProvider/Proto.Cluster.TestProvider.csproj @@ -2,7 +2,7 @@ Proto.Cluster.Consul 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Cluster/DefaultClusterContext.cs b/src/Proto.Cluster/DefaultClusterContext.cs index 09e446ea6b..4425cbbd8a 100644 --- a/src/Proto.Cluster/DefaultClusterContext.cs +++ b/src/Proto.Cluster/DefaultClusterContext.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -24,9 +23,6 @@ public class DefaultClusterContext : IClusterContext private readonly PidCache _pidCache; private readonly ShouldThrottle _requestLogThrottle; -#if !NET6_0_OR_GREATER - private readonly TaskClock _clock; -#endif private readonly ActorSystem _system; private static readonly ILogger Logger = Log.CreateLogger(); private readonly int _requestTimeoutSeconds; @@ -47,12 +43,6 @@ public DefaultClusterContext(Cluster cluster) _requestTimeoutSeconds = (int)config.ActorRequestTimeout.TotalSeconds; _legacyTimeouts = config.LegacyRequestTimeoutBehavior; -#if !NET6_0_OR_GREATER - var updateInterval = - TimeSpan.FromMilliseconds(Math.Min(config.ActorRequestTimeout.TotalMilliseconds / 2, 1000)); - _clock = new TaskClock(config.ActorRequestTimeout, updateInterval, cluster.System.Shutdown); - _clock.Start(); -#endif } public async Task RequestAsync(ClusterIdentity clusterIdentity, object message, ISenderContext context, @@ -115,12 +105,8 @@ public DefaultClusterContext(Cluster cluster) { context.Request(pid, message, future.Pid); var task = future.Task; - -#if NET6_0_OR_GREATER + await task.WaitAsync(CancellationTokens.FromSeconds(_requestTimeoutSeconds)).ConfigureAwait(false); -#else - await Task.WhenAny(task, _clock.CurrentBucket).ConfigureAwait(false); -#endif if (task.IsCompleted) { @@ -335,49 +321,6 @@ private async ValueTask RemoveFromSource(ClusterIdentity clusterIdentity, PidSou } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static (ResponseStatus Ok, T?) ToResult(PidSource source, ISenderContext context, object result) - { - var message = MessageEnvelope.UnwrapMessage(result); - - if (message is DeadLetterResponse) - { - if (!context.System.Shutdown.IsCancellationRequested && Logger.IsEnabled(LogLevel.Debug)) - { - Logger.LogDebug("TryRequestAsync failed, dead PID from {Source}", source); - } - - return (ResponseStatus.DeadLetter, default); - } - - if (message == null) - { - return (ResponseStatus.Ok, default); - } - - if (message is T t) - { - return (ResponseStatus.Ok, t); - } - - if (typeof(T) == typeof(MessageEnvelope)) - { - return (ResponseStatus.Ok, (T)(object)MessageEnvelope.Wrap(result)); - } - - Logger.LogError("Unexpected message. Was type {Type} but expected {ExpectedType}", message.GetType(), - typeof(T)); - - return (ResponseStatus.InvalidResponse, default); - } - - private enum ResponseStatus - { - Ok, - InvalidResponse, - DeadLetter - } - private enum PidSource { Cache, diff --git a/src/Proto.Cluster/Proto.Cluster.csproj b/src/Proto.Cluster/Proto.Cluster.csproj index 22208c0fe7..98648bb6de 100644 --- a/src/Proto.Cluster/Proto.Cluster.csproj +++ b/src/Proto.Cluster/Proto.Cluster.csproj @@ -4,7 +4,7 @@ true enable 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.OpenTelemetry/Proto.OpenTelemetry.csproj b/src/Proto.OpenTelemetry/Proto.OpenTelemetry.csproj index ba69c34ddb..6cb00f860b 100644 --- a/src/Proto.OpenTelemetry/Proto.OpenTelemetry.csproj +++ b/src/Proto.OpenTelemetry/Proto.OpenTelemetry.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 enable 10 diff --git a/src/Proto.Persistence.Couchbase/Proto.Persistence.Couchbase.csproj b/src/Proto.Persistence.Couchbase/Proto.Persistence.Couchbase.csproj index 85be8d950c..d1935ba263 100644 --- a/src/Proto.Persistence.Couchbase/Proto.Persistence.Couchbase.csproj +++ b/src/Proto.Persistence.Couchbase/Proto.Persistence.Couchbase.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.DynamoDB/Proto.Persistence.DynamoDB.csproj b/src/Proto.Persistence.DynamoDB/Proto.Persistence.DynamoDB.csproj index ef51290f6d..7e0c431246 100644 --- a/src/Proto.Persistence.DynamoDB/Proto.Persistence.DynamoDB.csproj +++ b/src/Proto.Persistence.DynamoDB/Proto.Persistence.DynamoDB.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.Marten/Proto.Persistence.Marten.csproj b/src/Proto.Persistence.Marten/Proto.Persistence.Marten.csproj index 25e91b4763..cceb81d9c5 100644 --- a/src/Proto.Persistence.Marten/Proto.Persistence.Marten.csproj +++ b/src/Proto.Persistence.Marten/Proto.Persistence.Marten.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.MongoDB/Proto.Persistence.MongoDB.csproj b/src/Proto.Persistence.MongoDB/Proto.Persistence.MongoDB.csproj index a2ad2bd531..e050536dc2 100644 --- a/src/Proto.Persistence.MongoDB/Proto.Persistence.MongoDB.csproj +++ b/src/Proto.Persistence.MongoDB/Proto.Persistence.MongoDB.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.RavenDB/Proto.Persistence.RavenDB.csproj b/src/Proto.Persistence.RavenDB/Proto.Persistence.RavenDB.csproj index 27f9a26518..82d6b5110b 100644 --- a/src/Proto.Persistence.RavenDB/Proto.Persistence.RavenDB.csproj +++ b/src/Proto.Persistence.RavenDB/Proto.Persistence.RavenDB.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.SqlServer/Proto.Persistence.SqlServer.csproj b/src/Proto.Persistence.SqlServer/Proto.Persistence.SqlServer.csproj index cc20934941..f985e090db 100644 --- a/src/Proto.Persistence.SqlServer/Proto.Persistence.SqlServer.csproj +++ b/src/Proto.Persistence.SqlServer/Proto.Persistence.SqlServer.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence.Sqlite/Proto.Persistence.Sqlite.csproj b/src/Proto.Persistence.Sqlite/Proto.Persistence.Sqlite.csproj index ead919c7da..29ee181e40 100644 --- a/src/Proto.Persistence.Sqlite/Proto.Persistence.Sqlite.csproj +++ b/src/Proto.Persistence.Sqlite/Proto.Persistence.Sqlite.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Persistence/Proto.Persistence.csproj b/src/Proto.Persistence/Proto.Persistence.csproj index 2a59053625..af653d715b 100644 --- a/src/Proto.Persistence/Proto.Persistence.csproj +++ b/src/Proto.Persistence/Proto.Persistence.csproj @@ -3,7 +3,7 @@ true enable 10 - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.Remote/Proto.Remote.csproj b/src/Proto.Remote/Proto.Remote.csproj index 76246d44fe..7bfc12338f 100644 --- a/src/Proto.Remote/Proto.Remote.csproj +++ b/src/Proto.Remote/Proto.Remote.csproj @@ -4,7 +4,7 @@ true enable 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/Proto.TestKit/Proto.TestKit.csproj b/src/Proto.TestKit/Proto.TestKit.csproj index dd8f0f083a..e86cba7549 100644 --- a/src/Proto.TestKit/Proto.TestKit.csproj +++ b/src/Proto.TestKit/Proto.TestKit.csproj @@ -1,6 +1,6 @@  - netstandard2.1;net6.0;net7.0 + net6.0;net7.0 true enable 10 diff --git a/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs index 47b690aca7..f12aab34f3 100644 --- a/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs +++ b/tests/Proto.Actor.Tests/Futures/SharedFutureBugTests.cs @@ -18,6 +18,7 @@ public async Task Should_get_unique_future() for (int i = 0; i < count; i++) { var f = context.GetFuture(); + var s = f.Pid.ToDiagnosticString(); hashSet.Add(s); } diff --git a/tests/Proto.Actor.Tests/Proto.Actor.Tests.csproj b/tests/Proto.Actor.Tests/Proto.Actor.Tests.csproj index 2ab6efb47f..d10d24640b 100644 --- a/tests/Proto.Actor.Tests/Proto.Actor.Tests.csproj +++ b/tests/Proto.Actor.Tests/Proto.Actor.Tests.csproj @@ -4,7 +4,7 @@ Proto.Tests 10 Library - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 enable diff --git a/tests/Proto.Cluster.CodeGen.Tests/Proto.Cluster.CodeGen.Tests.csproj b/tests/Proto.Cluster.CodeGen.Tests/Proto.Cluster.CodeGen.Tests.csproj index 73f3f07f12..97a290e6a8 100644 --- a/tests/Proto.Cluster.CodeGen.Tests/Proto.Cluster.CodeGen.Tests.csproj +++ b/tests/Proto.Cluster.CodeGen.Tests/Proto.Cluster.CodeGen.Tests.csproj @@ -3,7 +3,7 @@ false Library - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.Cluster.Identity.Tests/Proto.Cluster.Identity.Tests.csproj b/tests/Proto.Cluster.Identity.Tests/Proto.Cluster.Identity.Tests.csproj index 096597d484..a1220af0de 100644 --- a/tests/Proto.Cluster.Identity.Tests/Proto.Cluster.Identity.Tests.csproj +++ b/tests/Proto.Cluster.Identity.Tests/Proto.Cluster.Identity.Tests.csproj @@ -1,7 +1,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 Linux ..\docker-compose\docker-compose.dcproj enable diff --git a/tests/Proto.Cluster.MongoIdentity.Tests/Proto.Cluster.MongoIdentity.Tests.csproj b/tests/Proto.Cluster.MongoIdentity.Tests/Proto.Cluster.MongoIdentity.Tests.csproj index 5b52a1575e..0dd5d43076 100644 --- a/tests/Proto.Cluster.MongoIdentity.Tests/Proto.Cluster.MongoIdentity.Tests.csproj +++ b/tests/Proto.Cluster.MongoIdentity.Tests/Proto.Cluster.MongoIdentity.Tests.csproj @@ -1,7 +1,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 Linux ..\docker-compose\docker-compose.dcproj enable diff --git a/tests/Proto.Cluster.PartitionIdentity.Tests/Proto.Cluster.PartitionIdentity.Tests.csproj b/tests/Proto.Cluster.PartitionIdentity.Tests/Proto.Cluster.PartitionIdentity.Tests.csproj index 33306e7119..96faeb58e5 100644 --- a/tests/Proto.Cluster.PartitionIdentity.Tests/Proto.Cluster.PartitionIdentity.Tests.csproj +++ b/tests/Proto.Cluster.PartitionIdentity.Tests/Proto.Cluster.PartitionIdentity.Tests.csproj @@ -2,7 +2,7 @@ 8981 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 enable false 10 diff --git a/tests/Proto.Cluster.PubSub.Tests/Proto.Cluster.PubSub.Tests.csproj b/tests/Proto.Cluster.PubSub.Tests/Proto.Cluster.PubSub.Tests.csproj index 618765417c..37d5aaa9cb 100644 --- a/tests/Proto.Cluster.PubSub.Tests/Proto.Cluster.PubSub.Tests.csproj +++ b/tests/Proto.Cluster.PubSub.Tests/Proto.Cluster.PubSub.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 enable enable diff --git a/tests/Proto.Cluster.RedisIdentity.Tests/Proto.Cluster.RedisIdentity.Tests.csproj b/tests/Proto.Cluster.RedisIdentity.Tests/Proto.Cluster.RedisIdentity.Tests.csproj index 17b68a4a58..841978cc32 100644 --- a/tests/Proto.Cluster.RedisIdentity.Tests/Proto.Cluster.RedisIdentity.Tests.csproj +++ b/tests/Proto.Cluster.RedisIdentity.Tests/Proto.Cluster.RedisIdentity.Tests.csproj @@ -1,7 +1,7 @@ 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 Linux ..\docker-compose\docker-compose.dcproj enable diff --git a/tests/Proto.Cluster.Tests/ClusterFixture.cs b/tests/Proto.Cluster.Tests/ClusterFixture.cs index 965458456b..fab5663f0c 100644 --- a/tests/Proto.Cluster.Tests/ClusterFixture.cs +++ b/tests/Proto.Cluster.Tests/ClusterFixture.cs @@ -77,9 +77,6 @@ static ClusterFixture() protected ClusterFixture( int clusterSize, Func? configure = null) { _reporter = new GithubActionsReporter(GetType().Name); -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif ClusterSize = clusterSize; _configure = configure; ClusterName = $"test-cluster-{Guid.NewGuid().ToString().Substring(0, 6)}"; diff --git a/tests/Proto.Cluster.Tests/Proto.Cluster.Tests.csproj b/tests/Proto.Cluster.Tests/Proto.Cluster.Tests.csproj index 28ec51c263..bf591f3595 100644 --- a/tests/Proto.Cluster.Tests/Proto.Cluster.Tests.csproj +++ b/tests/Proto.Cluster.Tests/Proto.Cluster.Tests.csproj @@ -2,7 +2,7 @@ 8981 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.OpenTelemetry.Tests/Proto.OpenTelemetry.Tests.csproj b/tests/Proto.OpenTelemetry.Tests/Proto.OpenTelemetry.Tests.csproj index adf27f2fef..3233b6efeb 100644 --- a/tests/Proto.OpenTelemetry.Tests/Proto.OpenTelemetry.Tests.csproj +++ b/tests/Proto.OpenTelemetry.Tests/Proto.OpenTelemetry.Tests.csproj @@ -5,7 +5,7 @@ enable 10 false - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.Persistence.Tests/Proto.Persistence.Tests.csproj b/tests/Proto.Persistence.Tests/Proto.Persistence.Tests.csproj index 1382accb66..3d24ab5832 100644 --- a/tests/Proto.Persistence.Tests/Proto.Persistence.Tests.csproj +++ b/tests/Proto.Persistence.Tests/Proto.Persistence.Tests.csproj @@ -1,7 +1,7 @@  10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.Remote.Tests.Messages/Proto.Remote.Tests.Messages.csproj b/tests/Proto.Remote.Tests.Messages/Proto.Remote.Tests.Messages.csproj index e0385ca1e9..dee6136287 100644 --- a/tests/Proto.Remote.Tests.Messages/Proto.Remote.Tests.Messages.csproj +++ b/tests/Proto.Remote.Tests.Messages/Proto.Remote.Tests.Messages.csproj @@ -3,7 +3,7 @@ 8981 false 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.Remote.Tests/Proto.Remote.Tests.csproj b/tests/Proto.Remote.Tests/Proto.Remote.Tests.csproj index 9285148f56..5539045694 100644 --- a/tests/Proto.Remote.Tests/Proto.Remote.Tests.csproj +++ b/tests/Proto.Remote.Tests/Proto.Remote.Tests.csproj @@ -1,7 +1,7 @@  10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/tests/Proto.TestFixtures/Proto.TestFixtures.csproj b/tests/Proto.TestFixtures/Proto.TestFixtures.csproj index 225ee5e832..312ca54f23 100644 --- a/tests/Proto.TestFixtures/Proto.TestFixtures.csproj +++ b/tests/Proto.TestFixtures/Proto.TestFixtures.csproj @@ -2,7 +2,7 @@ false 10 - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 From 779c30599ec81901bd4313eb920c329d6474a6aa Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 16 Apr 2023 11:39:41 +0200 Subject: [PATCH 4/4] remove conditionals --- src/Proto.Actor/Mailbox/Mailbox.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Proto.Actor/Mailbox/Mailbox.cs b/src/Proto.Actor/Mailbox/Mailbox.cs index 6894fa368b..3888bde132 100644 --- a/src/Proto.Actor/Mailbox/Mailbox.cs +++ b/src/Proto.Actor/Mailbox/Mailbox.cs @@ -305,11 +305,7 @@ private void Schedule() { if (_dispatcher == Dispatchers.DefaultDispatcher) { -#if NET5_0_OR_GREATER ThreadPool.UnsafeQueueUserWorkItem(this, false); -#else - ThreadPool.UnsafeQueueUserWorkItem(RunWrapper, this); -#endif } else {