ORLEANS0004: Add missing serialization attributes
| Property | Value |
|---|---|
| Category | Usage |
| Severity | Error |
| Code fix | Available |
A class, struct, or record marked [GenerateSerializer] has an instance field or auto-property without [Id] or [NonSerialized].
Impact
Section titled “Impact”Unmarked members can be omitted from Orleans serialization, producing default or lost values and an incomplete version-tolerant schema.
How to fix
Section titled “How to fix”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.
Suppress the diagnostic
Section titled “Suppress the diagnostic”Prefer [NonSerialized] for intentional exclusion. Suppress only for test fixtures or legacy types whose omission is explicitly required.
[*.cs]dotnet_diagnostic.ORLEANS0004.severity = none