Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Suppress a best practice error in D365FO X++ code

Posted on by 20

I have some best practices errors that I would like to supress.. I'm not having any luck with the attribute OR the file.. as below.. can anyone shed some light on this for me please?

I haven't found any information about using the attribute apart from to suppress "BPParameterNotUsed" .. can it be used to suppress anything else?

For example:

Display method displayLocationDescription on control Address_displayLocationDescription in form AGCPlantRequest not cached

Actually it is (or should be?) cached but I'm still getting the error:

pastedimage1661217835760v1.png

And, assuming the above can't be used on objects.. I am having trouble with using the the BPSuppression.xml file too!

Example error:

Description: Path: [AxDataEntityViewExtension/EcoResReleasedProductV2Entity.AGC/Relations/CatchWeightItemHandlingPolicy/RelatedDataEntity]:Referenced object 'WHSCatchWeightItemHandlingPolicyEntity' is marked as obsolete.
Project: 645_PlantHire (VAR) [AGC]   
Path: K:\AosService\PackagesLocalDirectory\AGC\AGC\AxDataEntityViewExtension
File: K:\AosService\PackagesLocalDirectory\AGC\AGC\AxDataEntityViewExtension\EcoResReleasedProductV2Entity.AGC.xml

still appearing after I have added this file:
K:\AosService\PackagesLocalDirectory\AGC\AGC\AxIgnoreDiagnosticList\AGC_BPSuppressions.xml

<?xml version="1.0" encoding="utf-8"?>
<IgnoreDiagnostics xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsd="">www.w3.org/.../XMLSchema">
    <!--
    *************************************************************************************************************************
    *** START OF XML SCHEMA
    *************************************************************************************************************************
    -->
    <xs:schema xmlns:xs="">www.w3.org/.../XMLSchema" id="defaultSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
        <xsd:element name="Name" type="xsd:string" />
        <xsd:element name="Items">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="0" maxOccurs="unbounded" name="Diagnostic">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="DiagnosticType" type="xsd:string" />
                                <xsd:element name="Severity" type="xsd:string" />
                                <xsd:element name="Path" type="xsd:string" />
                                <xsd:element name="Moniker" type="xsd:string" />
                                <xsd:element name="Message" type="xsd:string" />
                                <xsd:element name="Justification" type="xsd:string" />
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xs:schema>
    <!--
    *************************************************************************************************************************
    *** START OF XML BODY
    *************************************************************************************************************************
    -->
    <Name>AGC_BPSuppressions</Name>
    <Items>
        <!-- Diagnostic item template
        <Diagnostic>
            <DiagnosticType>BestPractices</DiagnosticType>
            <Severity>Warning</Severity>
            <Path>(path given in warning messsage)</Path>
            <Moniker>(moniker given in error message)</Moniker>
            <Message>(message displayed by the best practices)</Message>
            <Justification>(a justification for why you are ignoring this message)</Justification>
        </Diagnostic>
        -->
        <!--
       *************************************************************************************************************************
       *** Suppressions
       *************************************************************************************************************************
        -->
        <Diagnostic>
            <DiagnosticType>BestPractices</DiagnosticType>
            <Severity>Warning</Severity>
            <Path>dynamics://DataEntityViewExtension/EcoResReleasedProductV2Entity.AGC/Relations/CatchWeightItemHandlingPolicy/RelatedDataEntity</Path>
            <Moniker>ReferencedObjectIsObsolete</Moniker>
            <Message>Referenced object 'WHSCatchWeightItemHandlingPolicyEntity' is marked as obsolete. </Message>
            <Justification>Extension of EcoResReleasedProductV2Entity, not able to remove reference to WHSProductFilterGroupEntity from underlying entity.</Justification>
        </Diagnostic>
        <Diagnostic>
            <DiagnosticType>BestPractices</DiagnosticType>
            <Severity>Warning</Severity>
            <Path>dynamics://DataEntityViewExtension/EcoResReleasedProductV2Entity.AGC/Relations/WHSProductFilterGroups/RelatedDataEntity</Path>
            <Moniker>ReferencedObjectIsObsolete</Moniker>
            <Message>Referenced object 'WHSProductFilterGroupEntity' is marked as obsolete. </Message>
            <Justification>Extension of EcoResReleasedProductV2Entity, not able to remove reference to WHSProductFilterGroupEntity from underlying entity.</Justification>
        </Diagnostic>
        <Diagnostic>
            <DiagnosticType>BestPractices</DiagnosticType>
            <Severity>Warning</Severity>
            <Path>dynamics://DataEntityViewExtension/EcoResReleasedProductV2Entity.AGC/Fields/PackageHandlingTime/DataField</Path>
            <Moniker>ReferencedObjectIsObsolete</Moniker>
            <Message>Referenced object 'WMSPickingQtyTime' is marked as obsolete. </Message>
            <Justification>Extension of EcoResReleasedProductV2Entity, not able to remove reference to WHSProductFilterGroupEntity from underlying entity.</Justification>
        </Diagnostic>
    </Items>
</IgnoreDiagnostics>

  • LCAS Profile Picture
    LCAS 13 on at
    Suppress a best practice error in D365FO X++ code
    Hi!
    Did you manage to have the <path> to work?
    I tried copying the path value from file generated by VS, like BuildModelResult.xml or BuildProjectResult.xml or BPCheck.xml, but the warning still persists.
    What it annoys me is that it is even a standard object raising BPWarning on my extensions, which I cannot fix and would like to have a cleaner Warning view to concentrate on what matters and what I can actually fix.
     
    Any insight?
    Thanks!
  • AngelaBuchanan Profile Picture
    AngelaBuchanan 20 on at
    RE: Suppress a best practice error in D365FO X++ code

    Thanks Harry, I've read through the link you provided.. but yes I think I have done what I'm meant to for both approaches.

    One thing I'm not sure is of the file path. I tried to figure it out from the places I could see a likely value as detailed below... but maybe I have this wrong?

    In the output window when I build I see one like this:
    K:\AosService\PackagesLocalDirectory\AGC\AGC\AxForm\AGCPlantRecord.xml(0,0):  BPCheckDisplayMethodCached: Display method offHireMinDate on control HireDates_offHireMinDate in form AGCPlantRecord not cached

    In the error list I see three more:
    Path: [AxDataEntityViewExtension/EcoResReleasedProductV2Entity.AGC/Relations/CatchWeightItemHandlingPolicy/RelatedDataEntity]:
    Referenced object 'WHSCatchWeightItemHandlingPolicyEntity' is marked as obsolete.    645_PlantHire (VAR) [AGC]    1    
    K:\AosService\PackagesLocalDirectory\AGC\AGC\AxDataEntityViewExtension    
    K:\AosService\PackagesLocalDirectory\AGC\AGC\AxDataEntityViewExtension\EcoResReleasedProductV2Entity.AGC.xml    0    0        Build        

    I'm also apparantly meant to be able to see it in K:\AosService\PackagesLocalDirectory\AGC\BuildProjectResult.xml but this doesn't show my best practices (only an AssemblyFileNotFound warning as below).

    <?xml version="1.0" encoding="utf-8"?>
    <Diagnostics
      GenerationTime="2022-08-25T01:53:25.7118191+00:00">
      <Items>
        <Diagnostic>
          <DiagnosticType>ExternalReference</DiagnosticType>
          <Severity>Warning</Severity>
          <Path>dynamics://Reference/Azure.Core</Path>
          <Moniker>AssemblyFileNotFound</Moniker>
          <Message>Assembly 'Azure.Core, Version=1.15.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' failed to load because it was not found.</Message>
        </Diagnostic>

  • Deepak Agarwal Profile Picture
    Deepak Agarwal 148 on at
    RE: Suppress a best practice error in D365FO X++ code

    It seems you tried both ways, which can be used generally. Still sharing this link to double check for any missing link,

    www.theaxapta.com/.../best-practice-bp-warning-suppression-in.html

  • AngelaBuchanan Profile Picture
    AngelaBuchanan 20 on at
    RE: Suppress a best practice error in D365FO X++ code

    HI André,

    Yes it does:

    pastedimage1661378495413v1.png

    pastedimage1661378526054v2.png

    I've tried editing in a separate instance of Visual Studio too, as I read that it should be done that way.. but didn't seem to make any difference.

    Thanks :-)
    Angela

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,188 Super User 2024 Season 2 on at
    RE: Suppress a best practice error in D365FO X++ code

    Hi Angela,

    If you Right-click on the project and select ‘Edit Best practice Suppression’, does this open your BP suppression XML file?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans