Skip to content

ORLEANS0004: Add missing serialization attributes

PropertyValue
CategoryUsage
SeverityError
Code fixAvailable

A class, struct, or record marked [GenerateSerializer] has an instance field or auto-property without [Id] or [NonSerialized].

Unmarked members can be omitted from Orleans serialization, producing default or lost values and an incomplete version-tolerant schema.

Assign stable, unique [Id(n)] values to serialized members. Mark members which are intentionally excluded with [NonSerialized].

The code fix can add sequential IDs after the highest existing ID or mark all unannotated members as non-serialized. Review generated IDs before committing them and never renumber deployed fields.

Prefer [NonSerialized] for intentional exclusion. Suppress only for test fixtures or legacy types whose omission is explicitly required.

[*.cs]
dotnet_diagnostic.ORLEANS0004.severity = none