Skip to content

ARC0024: Generated value names must be non-empty and unique

Each generated parameter resolves its name from [GeneratedValue("name")], or from the C# parameter name when no explicit name is supplied. Names must not be empty or whitespace, and must be unique within the command’s effective Handle() method using ordinal, case-sensitive comparison. This includes inherited handlers. The rule reports the later parameter and the effective command when names collide, even if the parameters have different types. Default severity: Error.

The examples use this identifier, the same declaration as in generated values:

using System;
using Cratis.Arc.Commands.ModelBound;
using Cratis.Concepts;
public record CartId(Guid Value) : ConceptAs<Guid>(Value), IGeneratable<CartId>
{
public static CartId New() => new(GenerateValue.Uuid());
}

Compile each alternative below together with it, one at a time; the first intentionally produces ARC0024.

[Command]
public record AllocateCartIds
{
public (CartId First, CartId Second) Handle(
[GeneratedValue] CartId first,
[GeneratedValue("first")] CartId second) => (first, second);
}

Use distinct explicit names, or let each parameter use its own name:

[Command]
public record AllocateCartIds
{
public (CartId First, CartId Second) Handle(
[GeneratedValue("first")] CartId first,
[GeneratedValue("second")] CartId second) => (first, second);
}

Explicit names keep scenario pins stable across parameter renames. "cart" and "Cart" are distinct names; different commands can reuse either name.