diff --git a/src/Akka.sln b/src/Akka.sln index 7af6015fac7..1f934f7b038 100644 --- a/src/Akka.sln +++ b/src/Akka.sln @@ -56,6 +56,8 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{10C5B1E8-15B5-4EB3-81AE-1FC054FE1305}" ProjectSection(SolutionItems) = preProject ..\build.fsx = ..\build.fsx + Directory.Build.props = Directory.Build.props + NuGet.Config = NuGet.Config EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Contrib", "Contrib", "{588C1513-FAB6-42C3-B6FC-3485F13620CF}" diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7f267989967..13facba8306 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -69,6 +69,9 @@ If you want to see the [full set of changes made in Akka.NET v1.5.14, click here | 1 | 227 | 25 | Drew | | 1 | 1 | 1 | szaliszali | + + + diff --git a/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs b/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs index 762595f1c2b..55dfc205c4d 100644 --- a/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs +++ b/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs @@ -298,7 +298,9 @@ public override int GetNrOfInstances(ActorSystem system) /// public override ActorBase CreateRouterActor() { +#pragma warning disable AK1000 return new ClusterRouterPoolActor(Local.SupervisorStrategy, Settings); +#pragma warning restore AK1000 } /// @@ -445,7 +447,9 @@ public override IEnumerable GetPaths(ActorSystem system) /// public override ActorBase CreateRouterActor() { +#pragma warning disable AK1000 return new ClusterRouterGroupActor(Settings); +#pragma warning restore AK1000 } /// diff --git a/src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs b/src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs index 2ccfb1a136c..8aced6069d8 100644 --- a/src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs +++ b/src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs @@ -53,12 +53,13 @@ public DataSource() { Receive(request => { + var sender = Sender; // create a source StreamLogs(request.StreamId) // materialize it using stream refs .RunWith(StreamRefs.SourceRef(), Context.System.Materializer()) // and send to sender - .PipeTo(Sender, success: sourceRef => new LogsOffer(request.StreamId, sourceRef)); + .PipeTo(sender, success: sourceRef => new LogsOffer(request.StreamId, sourceRef)); }); } @@ -96,12 +97,13 @@ public DataReceiver() { // obtain a source you want to offer var sink = LogsSinksFor(prepare.Id); + var sender = this.Sender; // materialize sink ref (remote is source data for us) StreamRefs.SinkRef() .To(sink) .Run(Context.System.Materializer()) - .PipeTo(Sender, success: sinkRef => new MeasurementsSinkReady(prepare.Id, sinkRef)); + .PipeTo(sender, success: sinkRef => new MeasurementsSinkReady(prepare.Id, sinkRef)); }); } diff --git a/src/core/Akka.Docs.Tests/Utilities/CircuitBreakerDocSpec.cs b/src/core/Akka.Docs.Tests/Utilities/CircuitBreakerDocSpec.cs index dc032296e91..659e24c6af2 100644 --- a/src/core/Akka.Docs.Tests/Utilities/CircuitBreakerDocSpec.cs +++ b/src/core/Akka.Docs.Tests/Utilities/CircuitBreakerDocSpec.cs @@ -51,7 +51,8 @@ public DangerousActorCallProtection() Receive(str => str.Equals("is my middle name"), _ => { - breaker.WithCircuitBreaker(() => Task.FromResult(dangerousCall)).PipeTo(Sender); + var sender = this.Sender; + breaker.WithCircuitBreaker(() => Task.FromResult(dangerousCall)).PipeTo(sender); }); Receive(str => str.Equals("block for me"), _ => diff --git a/src/core/Akka.Streams.Tests/Dsl/StreamRefsSerializerSpec.cs b/src/core/Akka.Streams.Tests/Dsl/StreamRefsSerializerSpec.cs index 5249bf57923..21a377dc015 100644 --- a/src/core/Akka.Streams.Tests/Dsl/StreamRefsSerializerSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/StreamRefsSerializerSpec.cs @@ -80,12 +80,13 @@ public ProducerActor(string data) _data = data; Receive(_ => { + var sender = this.Sender; // create a source StreamLogs() // materialize it using stream refs .RunWith(StreamRefs.SourceRef(), Context.System.Materializer()) // and send to sender - .PipeTo(Sender, success: sourceRef => new EnvelopedStream(sourceRef)); + .PipeTo(sender, success: sourceRef => new EnvelopedStream(sourceRef)); }); Receive(_ => Sender.Tell("pong")); diff --git a/src/core/Akka.Streams.Tests/Dsl/StreamRefsSpec.cs b/src/core/Akka.Streams.Tests/Dsl/StreamRefsSpec.cs index 11418a5f833..b11e61a662a 100644 --- a/src/core/Akka.Streams.Tests/Dsl/StreamRefsSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/StreamRefsSpec.cs @@ -56,27 +56,31 @@ protected override bool Receive(object message) */ var source = Source.From(new[] { "hello", "world" }); var aref = source.RunWith(StreamRefs.SourceRef(), _materializer); - aref.PipeTo(Sender); + var sender = this.Sender; + aref.PipeTo(sender); return true; } case "give-infinite": { var source = Source.From(Enumerable.Range(1, int.MaxValue).Select(i => "ping-" + i)); var t = source.ToMaterialized(StreamRefs.SourceRef(), Keep.Right).Run(_materializer); - t.PipeTo(Sender); + var sender = this.Sender; + t.PipeTo(sender); return true; } case "give-fail": { var r = Source.Failed(new Exception("Boom!")) .RunWith(StreamRefs.SourceRef(), _materializer); - r.PipeTo(Sender); + var sender = this.Sender; + r.PipeTo(sender); return true; } case "give-complete-asap": { var r = Source.Empty().RunWith(StreamRefs.SourceRef(), _materializer); - r.PipeTo(Sender); + var sender = this.Sender; + r.PipeTo(sender); return true; } case "give-subscribe-timeout": @@ -85,7 +89,8 @@ protected override bool Receive(object message) .ToMaterialized(StreamRefs.SourceRef(), Keep.Right) .WithAttributes(StreamRefAttributes.CreateSubscriptionTimeout(TimeSpan.FromMilliseconds(500))) .Run(_materializer); - r.PipeTo(Sender); + var sender = this.Sender; + r.PipeTo(sender); return true; } case "receive": @@ -96,13 +101,15 @@ protected override bool Receive(object message) */ var sink = StreamRefs.SinkRef().To(Sink.ActorRef(_probe, "", ex => new Status.Failure(ex))) .Run(_materializer); - sink.PipeTo(Sender); + var sender = this.Sender; + sink.PipeTo(sender); return true; } case "receive-ignore": { var sink = StreamRefs.SinkRef().To(Sink.Ignore()).Run(_materializer); - sink.PipeTo(Sender); + var sender = Sender; + sink.PipeTo(sender); return true; } case "receive-subscribe-timeout": @@ -111,7 +118,8 @@ protected override bool Receive(object message) .WithAttributes(StreamRefAttributes.CreateSubscriptionTimeout(TimeSpan.FromMilliseconds(500))) .To(Sink.ActorRef(_probe, "", ex => new Status.Failure(ex))) .Run(_materializer); - sink.PipeTo(Sender); + var sender = this.Sender; + sink.PipeTo(sender); return true; } case "receive-32": diff --git a/src/core/Akka.TestKit/Akka.TestKit.csproj b/src/core/Akka.TestKit/Akka.TestKit.csproj index 1afc4261428..d73ac426381 100644 --- a/src/core/Akka.TestKit/Akka.TestKit.csproj +++ b/src/core/Akka.TestKit/Akka.TestKit.csproj @@ -29,7 +29,7 @@ - + diff --git a/src/core/Akka.Tests/Actor/ActorRefSpec.cs b/src/core/Akka.Tests/Actor/ActorRefSpec.cs index 5de3d99e377..0f10af60048 100644 --- a/src/core/Akka.Tests/Actor/ActorRefSpec.cs +++ b/src/core/Akka.Tests/Actor/ActorRefSpec.cs @@ -179,7 +179,7 @@ public async Task An_ActorRef_should_support_nested_ActorOfs() var a = Sys.ActorOf(Props.Create(() => new NestingActor(Sys))); a.Should().NotBeNull(); - Func t1 = async () => + var t1 = async () => { var nested = (IActorRef) await a.Ask("any"); nested.Should().NotBeNull(); @@ -523,15 +523,6 @@ protected override bool Receive(object message) } } - private class FailingChildInnerActor : FailingInnerActor - { - public FailingChildInnerActor(ActorBase fail) - : base(fail) - { - Fail = new InnerActor(); - } - } - private class OuterActor : ActorBase { private readonly IActorRef _inner; @@ -555,39 +546,6 @@ protected override bool Receive(object message) } } - private class FailingOuterActor : ActorBase - { - private readonly IActorRef _inner; - protected ActorBase Fail; - - public FailingOuterActor(IActorRef inner) - { - _inner = inner; - Fail = new InnerActor(); - } - protected override bool Receive(object message) - { - if (message.ToString() == "self") - { - Sender.Tell(Self); - } - else - { - _inner.Forward(message); - } - return true; - } - } - - private class FailingChildOuterActor : FailingOuterActor - { - public FailingChildOuterActor(IActorRef inner) - : base(inner) - { - Fail = new InnerActor(); - } - } - private class PoisonPilledActor : ActorBase { protected override bool Receive(object message) diff --git a/src/core/Akka.Tests/Dispatch/AsyncAwaitSpec.cs b/src/core/Akka.Tests/Dispatch/AsyncAwaitSpec.cs index f4193b34557..4ea5c448ed7 100644 --- a/src/core/Akka.Tests/Dispatch/AsyncAwaitSpec.cs +++ b/src/core/Akka.Tests/Dispatch/AsyncAwaitSpec.cs @@ -465,8 +465,9 @@ public AsyncPipeToDelayActor() { ReceiveAsync(async msg => { + var sender = Sender; #pragma warning disable CS4014 - Delayed(msg).PipeTo(Sender, Self); + Delayed(msg).PipeTo(sender); #pragma warning restore CS4014 await Task.Delay(3000); diff --git a/src/core/Akka.Tests/Routing/RoutingSpec.cs b/src/core/Akka.Tests/Routing/RoutingSpec.cs index caa66a37b2c..59480c37428 100644 --- a/src/core/Akka.Tests/Routing/RoutingSpec.cs +++ b/src/core/Akka.Tests/Routing/RoutingSpec.cs @@ -130,7 +130,8 @@ public InlineRouterActor() ReceiveAsync(s => s == "start", async _ => { var actor = Context.ActorOf(new RoundRobinPool(2).Props(Props.Create())); - await actor.Ask("hello").PipeTo(Sender); + var sender = this.Sender; + await actor.Ask("hello").PipeTo(sender); }); } } diff --git a/src/core/Akka/Akka.csproj b/src/core/Akka/Akka.csproj index 5c1e6b10ef1..95b4bcbf818 100644 --- a/src/core/Akka/Akka.csproj +++ b/src/core/Akka/Akka.csproj @@ -21,7 +21,7 @@ - + TextTemplatingFileGenerator diff --git a/src/examples/Cluster/Metrics/Samples.Cluster.Metrics.Common/FactorialBackend.cs b/src/examples/Cluster/Metrics/Samples.Cluster.Metrics.Common/FactorialBackend.cs index e117accd341..9c1184a7611 100644 --- a/src/examples/Cluster/Metrics/Samples.Cluster.Metrics.Common/FactorialBackend.cs +++ b/src/examples/Cluster/Metrics/Samples.Cluster.Metrics.Common/FactorialBackend.cs @@ -21,12 +21,12 @@ public FactorialBackend() Receive(n => { log.Info($"{Self.Path} received factorial job [{n}]"); - - Factorial(n).PipeTo(Sender); + var sender = Sender; + Factorial(n).PipeTo(sender); }); } - private async Task<(int, BigInteger)> Factorial(int n) + private static async Task<(int, BigInteger)> Factorial(int n) { var i = n; var accumulator = new BigInteger(1);