Skip to content

ARC0003: Handle() must be on [Command] type

Reports a public instance Handle() method on a non-command type when a parameter is a [Command] type. Move that behavior onto the command itself. Default severity: Error.

Compile these alternatives separately with Cratis.Arc.Core. The external handler deliberately triggers ARC0003. The command already has Handle() to avoid an unrelated ARC0004 diagnostic; it returns sample data, not persisted state.

using Cratis.Arc.Commands.ModelBound;
[Command]
public record NormalizeName(string Name)
{
public string Handle() => Name;
}
public class NormalizeNameHandler
{
public string Handle(NormalizeName command) => command.Name.Trim();
}

Remove the external handler and put its behavior on the command:

using Cratis.Arc.Commands.ModelBound;
[Command]
public record NormalizeName(string Name)
{
public string Handle() => Name.Trim();
}

These declarations illustrate handler placement; they are not complete host programs. See model-bound commands for the execution model.