Give every obsolete element a reason and tag
AL has two obsoletion mechanisms, depending on the symbol:
- microsoftlayer
- upgradedomain
- 2examples
- 2pull requests
Rule on GitHub · microsoft layer · upgrade · BC all · tier official · derived
Description
AL has two obsoletion mechanisms, depending on the symbol:
- Objects, fields, enum types, and enum values use the
ObsoleteState,ObsoleteReason, andObsoleteTagproperties.Pendingwarns while the element remains available;Removedblocks references. - Methods, variables, events, and other symbols use
[Obsolete('reason', 'tag')]. They do not have anObsoleteStateproperty.
In both forms, the reason should name the replacement and the tag should identify when the element became obsolete. Empty or missing guidance leaves consumers without an actionable migration path.
Best Practice
For an object or field, set all three properties together. For a method, variable, or event, provide both [Obsolete] arguments. Keep the original tag stable through the lifecycle rather than changing it to a planned removal version.
See sample: obsoletion-requires-reason-and-tag.good.al.
Anti Pattern
Setting only ObsoleteState = Pending/Removed on an object or field, or using [Obsolete('', '')] on a method, variable, or event. Both forms produce deprecation metadata without useful replacement guidance or traceability.
See sample: obsoletion-requires-reason-and-tag.bad.al.
See also
obsolete-pending-to-removed-staging.md— when to advancePendingtoRemovedand write upgrade code.
Examples
Changed by
- #174 Make BCQuality documentation easier for partners to get started, 2026-09-09
- #93 Fix lifecycle compatibility guidance, 2026-07-14
From microsoft/BCQuality at a4593a1, MIT License, Copyright (c) 2026 Microsoft Corporation (license).