| Severity | Warning |
| Reported by | Metalama.Framework (Roslyn analyzer) |
| Message | The [Durable] attribute on '<Type>' has no effect, because '<Type>' derives from or implements '<ContractSource>', which already requires it. Remove the attribute. |
Cause
At design time, the process that analyzes your solution lives for as long as the solution is open, and Roslyn creates a new compilation on essentially every keystroke. An object that outlives a single request must therefore not hold a compilation, a syntax tree, a symbol, or a code-model declaration. The [Durable] attribute, defined in the Metalama.Framework.Utilities namespace, states that a type is safe to be held across compilations, and an analyzer verifies that every instance field and automatically implemented property of the type is durable.
The contract propagates: a type that derives from, or implements, a type marked [Durable] is bound by the contract whether or not it carries the attribute. Marking an interface is precisely a way to require that all its implementations be durable.
The analyzer reports LAMA0874 on the attribute when a type carries [Durable] and one of its base classes or interfaces, direct or indirect, already carries it. In the message, <Type> is the type that carries the redundant attribute, and <ContractSource> is the base class or interface from which the contract is inherited. Removing the attribute changes nothing: the type is checked identically, and the other rules of the analyzer still report any non-durable member.
This diagnostic is reported by a Roslyn analyzer, which snapshot tests of aspects don't run, so it can't be shown in an example. The editor fades the attribute, because the diagnostic carries the Unnecessary tag.
Resolution
Delete the [Durable] attribute from the type named in the message. Keep the attribute on <ContractSource>, which is the declaration that exports the obligation.