Skip to content

ARC0004: [Command] type must have public Handle() method

A [Command] type must declare a public instance Handle() method. Missing, non-public, and static handlers do not satisfy this check. Default severity: Error.

Each block is a separate declaration example for a project referencing Cratis.Arc.Core, not a runnable host. The first two intentionally produce ARC0004.

Missing handler:

using Cratis.Arc.Commands.ModelBound;
[Command]
public record NormalizeName(string Name);

Non-public handler:

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

Corrected declaration:

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

The synchronous string is an ordinary response; a handler need not return an event. See model-bound commands for supported behavior.