Browse pages
LS5006: Marked Event or Exception Is Not Partial
LS5006 is a compiler check that reports a marked domain event or rule exception not declared as a partial type, because the generator cannot add the runtime value to a type with no second part. This page states what the rule reports, where the error sits, and how to declare the type partial.
Reference#
What the Rule Enforces#
LS5006 enforces Declare Marked Events and Exceptions as Partial Types (litespec/backend/dotnet/stack#declare-marked-events-and-exceptions-as-partial-types). It runs in Domain only. Its category is LiteSpec.Traceability.
What the Rule Reports#
The rule reports a domain event or a rule exception carrying a mark that is not declared partial, in a project where the analyzer package generates values. The diagnostic sits on the type name.
Failing Example#
/// <implements>event/expense.submitted</implements>
public sealed record ExpenseSubmittedEvent(ExpenseId ExpenseId, Money Amount) : IDomainEvent;Passing Example#
/// <implements>event/expense.submitted</implements>
public sealed partial record ExpenseSubmittedEvent(ExpenseId ExpenseId, Money Amount) : IDomainEvent;How to Fix#
Declare the type partial, so the generator can add the runtime value as a second part. A code fix adds partial, with Fix All.
Notes#
What the Rule Ignores#
The rule does not report an event or exception with no mark. It does not report a type that is already partial. The rule stays silent when no .litespec/project.json is in reach, or when the docs root it names cannot be resolved; the CLI owns that configuration error. It does not run outside Domain.
Severity#
The rule reports an error. A finding that a live exception covers stays silent. An .editorconfig entry for the rule id overrides the computed severity.