BP Suppression

February 22, 2023
By: Andy Castillo

Sometimes you are making code changes, additions to extensions, or even just writing new code and you find that the compiler is giving you best practice warnings related to something you’ve been doing. Most of the time this can be handled by inspecting your code and resolving the warning. However, sometimes these best practice warnings are being triggered by something in a base model, which is only now being brought to light by your changes.

In these cases, suppressing these warnings is the optimal way to remove them from your compiler output and give you a clean build. While there is sufficient information on how to add the warning suppression online, I have found it difficult to identify the correct information to include in your suppression. I intend to cover that below using the scenario that I ran into:

SCENARIO

I had made some field changes to the entity InventInventoryCountingReasonCodeEntity, by adding a field to the underlying datasource:

Entity table:
Entity table

New entity extension:
New entity extension

Upon saving and building these changes, I received the following BP warning:

K:\AosService\PackagesLocalDirectory\Tutorial\Tutorial\AxDataEntityViewExtension\InventInventoryCountingReasonCodeEntity.Tutorial.xml (0,0): FeatureClassNotSupported: Path: [AxDataEntityViewExtension/InventInventoryCountingReasonCodeEntity.Tutorial/Fields/LedgerDimension/FeatureClass]:Feature class does not have runtime support for this type
BP warning

Unfortunately, the base entity is triggering this warning on a field that we do not have access to modify. This is when a BP suppression will come in handy.

The first step is to go to your project > right click > select Edit Best Practice Suppressions
BP warning

This will give you an XML output of all the BP suppression currently active for your model. If this is the first time you are adding a suppression, you will see the following:
Active BP suppression

This is helpful, as it tells you what each part of the suppression should be – the problem here is where to find it?

Upon performing a full build of the model you are working in, navigate to the model files in File Explorer, and open the BuildModelResult XML document. In my case:
BuildModelResult XML document Lookup

Notice there are two BuildModelResult files. The text document contains a summary of the most recent model build and its output, including a count for all the errors and warnings given by the compiler. This does not include the information we need to add to our suppression.
BuildModelResult XML document

In the BuildModelResult XML document, locate the warning that was triggered by our earlier build:
BuildModelResult XML warning

The information in the above screenshot is precisely what we need for our suppression. From here we can either manually enter the info seen above, or copy/paste this into our suppression file and add the Justification tag.
BuildModelResult XML

Now we need only save this file, perform another full build of our working model and the warning will no longer appear in our BuildModelResult files or our compiler output:

BuildModelResult:
BuildModelResult

Compiler output:
BuildModelResult Compiler output