New rule to enforce pragma warning specifying a disabled rule

Important

This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365, Power Platform, and Cloud for Industry release plans.

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Mar 1, 2023 Apr 1, 2023

Business value

It is possible to use the #pragma warning disable to disable all rules. This is often not the intended use, so to support gating this, a new CodeCop rule has been introduced that allows mandating that disabled rules are specified explicitly.

Feature details

A new, optional CodeCop rule AA0246 has been added. Enabling this allows you to enforce that, when suppressing diagnostics using theĀ #pragma warning disable, the code(s) of the diagnostics to suppress must be specified instead of suppressing all analyzer diagnostics and compiler warnings.

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.

See also

CodeCop Warning AA0246 (docs)