Symptoms
A number of Diagnostic.Create calls pass fewer or more arguments than their
MessageFormat string references, so the rendered diagnostic message
still contains the unformatted {n} placeholder instead of
the expected symbol name.
Affected rules
| ID |
Rule |
Effect |
PC0001 |
EditableFlowField |
Message shows {0} instead of the field name |
PC0011 |
EventPublisherIsHandledByVar |
Message shows {0} instead of the parameter name |
LC0054 |
InterfaceObjectNameGuide |
Message shows {0} instead of the interface name |
LC0082 |
UseQueryOrFindWithNextInsteadOfCount |
Count() >= 1 is reported as Count() <> - operator collapsed to <>, compared value omitted |
AC0001 |
LookupPageIdAndDrillDownPageId |
Second argument passed but never rendered - list page name missing from message |
AC0012 |
IntegrationEventInInternalCodeunit |
Extra argument passed that the message doesn't reference |
Cause
Two independent classes of issues:
- Missing args at the call site -
Diagnostic.Create(descriptor, location) is called with no message args although the MessageFormat contains {0}. Affects PC0001, PC0011, LC0054.
- Resx / call-site drift - the number of args passed and the number of placeholders in the resx no longer match, either because the message was later reworded or the call site was later extended. Affects
AC0001, AC0012.
Additionally, LC0082's helper GetOperatorKind normalized every
non-= operator to <> and threw away the compared literal value, so
the emitted message could not describe the actual code being flagged.
Expected behaviour
Every diagnostic message renders with all placeholders substituted; the
operator and compared value in LC0082's message match the source code
being flagged.
Symptoms
A number of
Diagnostic.Createcalls pass fewer or more arguments than theirMessageFormatstring references, so the rendered diagnostic messagestill contains the unformatted
{n}placeholder instead ofthe expected symbol name.
Affected rules
PC0001{0}instead of the field namePC0011{0}instead of the parameter nameLC0054{0}instead of the interface nameLC0082Count() >= 1is reported asCount() <>- operator collapsed to<>, compared value omittedAC0001AC0012Cause
Two independent classes of issues:
Diagnostic.Create(descriptor, location)is called with no message args although theMessageFormatcontains{0}. AffectsPC0001,PC0011,LC0054.AC0001,AC0012.Additionally,
LC0082's helperGetOperatorKindnormalized everynon-
=operator to<>and threw away the compared literal value, sothe emitted message could not describe the actual code being flagged.
Expected behaviour
Every diagnostic message renders with all placeholders substituted; the
operator and compared value in
LC0082's message match the source codebeing flagged.