Skip to content

ARC0002: Missing [Command] attribute on command-like type

Types that look like commands (properties plus Handle methods) must be marked with [Command] to be recognized as commands.

Warning

public record CreateUser
{
public string Name { get; set; }
// ARC0002: Missing [Command] attribute
public void Handle()
{
// Command logic
}
}
[Command]
public record CreateUser
{
public string Name { get; set; }
public string Email { get; set; }
public void Handle()
{
// Command logic
}
}
[Command]
public record CreateUser
{
public string Name { get; set; }
public UserCreatedResult Handle()
{
return new UserCreatedResult { UserId = Guid.NewGuid() };
}
}

Commands are identified by the [Command] attribute. Without it:

  • Handlers are not discovered by the runtime.
  • Validation and metadata generation are incomplete.
  • Command routing becomes inconsistent across the system.
  • ARC0001: Incorrect query method signature on ReadModel