Skip to content

ORLEANS0013: Remove serialization identity attributes from a grain class

PropertyValue
CategoryUsage
SeverityError
Code fixAvailable

A class deriving from Grain, including Grain<TState>, is marked [Alias] or [GenerateSerializer].

Grain implementation instances are activation objects, not application payloads. Serializing the implementation introduces an incorrect data contract and can create alias conflicts.

Remove [Alias] and [GenerateSerializer] from the grain implementation. Apply serialization attributes to grain state and message types instead.

The code fix removes the attribute list containing the invalid attribute. Review the diff when the same attribute list contains unrelated attributes.

Suppress only for an unconventional integration which deliberately serializes the class independently of Orleans activation.

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