AK1002 false positive
Aaronontheweb opened this issue · comments
Version Information
Version of Akka.NET? Akka.NET v1.5.16, Akka.Analyzers v0.2.2
Describe the bug
This code is currently flagged as an error by AK1002
:
ReceiveAsync<StopActor>(async p =>
{
try
{
var actorSelection = Context.System.ActorSelection(p.ActorPath);
var actorRef = await actorSelection.ResolveOne(p.Timeout);
var stopped = await actorRef.GracefulStop(p.Timeout); // AK1002 false positive occurs here
if(stopped)
Sender.Tell(new CommandResponse($"Successfully terminated [{p.ActorPath}] within [{p.Timeout}]"));
else
Sender.Tell(new ErroredCommandResponse($"Failed to terminate [{p.ActorPath}] within [{p.Timeout}]"));
}
catch (ActorNotFoundException)
{
Sender.Tell(new CommandResponse($"No actor found at [{p.ActorPath}] - no termination required"));
}
catch (Exception e)
{
Sender.Tell(new ErroredCommandResponse($"Could not complete actor termination due to [{e.Message}]"));
}
});
This is just an actor await
-ing on a GracefulStop
, not on its own graceful stop.
Expected behavior
Should not be flagged.
Actual behavior
Is flagged.