diff --git a/src/core/Akka.Remote/EndpointManager.cs b/src/core/Akka.Remote/EndpointManager.cs index 4f101998288..fbd8704708e 100644 --- a/src/core/Akka.Remote/EndpointManager.cs +++ b/src/core/Akka.Remote/EndpointManager.cs @@ -515,10 +515,9 @@ private ICancelable PruneTimerCancelleable private void HandleStashedInbound(IActorRef endpoint, bool writerIsIdle) { - var stashed = _stashedInbound.GetOrElse(endpoint, new List()); - _stashedInbound.Remove(endpoint); - foreach (var ia in stashed) - HandleInboundAssociation(ia, writerIsIdle); + if (_stashedInbound.Remove(endpoint, out var value)) + foreach (var ia in value) + HandleInboundAssociation(ia, writerIsIdle); } private void KeepQuarantinedOr(Address remoteAddress, Action body)