AppSourceCop Analyzer Rules

AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource.

Rules

IdTitleCategoryDefault severity
AS0001Tables and table extensions that have been published must not be deleted.UpgradeError
AS0002Fields must not be deleted.UpgradeError
AS0003The previous version of the extension could not be found.UpgradeError
AS0004Fields must not change type, since dependent extensions may breakUpgradeError
AS0005Fields must not change nameUpgradeError
AS0006Tables that have been published must not change name.UpgradeError
AS0007Objects that have been published must not change namespace.UpgradeError
AS0008Defining reserved namespaces is not allowed.ConfigurationError
AS0009Key fields must not be changedUpgradeError
AS0010Keys must not be deletedUpgradeError
AS0011An affix is requiredExtensibilityError
AS0013The field identifier must be within the allowed rangeExtensibilityError
AS0014The project manifest must contain the allocated identifier rangeExtensibilityError
AS0015TranslationFile must be enabled.ExtensibilityError
AS0016Fields of field class 'Normal' must use the DataClassification property and its value should be different from ToBeClassifiedExtensibilityError
AS0018A procedure belonging to the public API cannot be removedUpgradeError
AS0019Event attributes cannot be removedUpgradeError
AS0020The type of events cannot be changed.UpgradeError
AS0021An argument in an event attribute cannot be changed to false.UpgradeError
AS0022An external scope cannot be removedUpgradeError
AS0023A return type cannot be modified in external proceduresUpgradeError
AS0024Parameters cannot be removed or added in external proceduresUpgradeError
AS0025Parameters cannot be modified, renamed, or removed from events.UpgradeError
AS0026The type and subtype of parameters cannot be modified in events and external proceduresUpgradeError
AS0027Modifying the array size of a parameter in events and external procedures is not allowedUpgradeError
AS0028Reducing the array size of a parameter in events and external procedures is not allowedUpgradeError
AS0029Pages and PageExtensions that have been published must not be deleted, since dependent extensions may breakUpgradeError
AS0030Pages that have been published must not be renamed.UpgradeError
AS0031Actions that have been published must not be deleted.UpgradeError
AS0032Controls that have been published must not be deleted.UpgradeError
AS0033Views that have been published must not be deleted.UpgradeError
AS0034Unsupported table property changeUpgradeError
AS0035Unsupported page property changeUpgradeWarning
AS0036Unsupported table field property changeUpgradeError
AS0038Unsupported table key property changeUpgradeError
AS0039Removing table properties that cause destructive changes is not allowedUpgradeError
AS0040Removing page properties that cause destructive changes is not allowedUpgradeWarning
AS0041Table field property changes that cause destructive changes must not be removedUpgradeError
AS0042Table key property changes that cause destructive changes must not be removedUpgradeError
AS0043The clustered key must not be deletedUpgradeError
AS0044Property changes that cause destructive changes are not allowedUpgradeError
AS0047The extension name is too long.ExtensibilityError
AS0048The publisher name is too long.ExtensibilityError
AS0049The access modifier of an application object cannot be changed to a value that provides less access.ExtensibilityError
AS0050The extensibility of an application object cannot be removedExtensibilityError
AS0051Manifest property is required for AppSource submissionExtensibilityError
AS0052The property 'url' must be set to a valid URLExtensibilityError
AS0053The compilation target of an application must be a value that is allowed in a multi-tenant SaaS environmentExtensibilityError
AS0054The AppSourceCop configuration must specify the set of affixes used by the applicationConfigurationError
AS0055The AppSourceCop configuration must specify the list of countries/regions targeted by the applicationConfigurationHidden
AS0056The country/region codes specified in the 'supportedCountries' property must be valid ISO 3166-1 alpha-2 codesConfigurationWarning
AS0057Translations must be provided for all the locales in which the application will be availableExtensibilityHidden
AS0058Only use AssertError in Test CodeunitsExtensibilityError
AS0059Reserved database tables are read-only in a multi-tenant environmentExtensibilityError
AS0060Unsafe methods cannot be invoked in an AppSource applicationExtensibilityError
AS0061Procedures must not subscribe to CompanyOpen eventsExtensibilityError
AS0062Page controls and actions must use the ApplicationArea propertyExtensibilityError
AS0063Removing a var modifier in events is not allowedUpgradeError
AS0064Interface implementations that have been published must not be deleted.UpgradeError
AS0065Interfaces that have been published must not be deleted.UpgradeError
AS0066A new method to an interface that has been published must not be added.UpgradeError
AS0067Adding an interface to an enum that has been published must have a default implementation.UpgradeError
AS0068Changing a table extension's target is not allowed.UpgradeError
AS0069An enum field replacing an option field should have at least the same number of members.UpgradeError
AS0070An enum field replacing an option field should preserve the member names.UpgradeError
AS0071An enum field replacing an option field should preserve the member ordinal values.UpgradeError
AS0072The attribute tag must be set to the next release version.DesignHidden
AS0073Attribute tag must be set.DesignHidden
AS0074The attribute tag must be the same across branches.DesignHidden
AS0075Attribute reason must be set.DesignWarning
AS0076Attribute tag format.DesignHidden
AS0077Adding a var modifier in events is not allowedUpgradeError
AS0078Adding or removing a var modifier in external procedures is not allowedUpgradeError
AS0079An affix is required for procedures defined in extension objects.ExtensibilityWarning
AS0080Fields must not decrease in lengthUpgradeError
AS0081InternalsVisibleTo should not be used as a security feature.ExtensibilityWarning
AS0082It is not allowed to rename an enum value.UpgradeError
AS0083It is not allowed to delete a value from an enum.UpgradeError
AS0084The ID range assigned to the extension must be within the allowed rangeExtensibilityError
AS0085Use the 'application' property instead of specifying explicit dependencies.ExtensibilityWarning
AS0086Fields must not increase in lengthUpgradeWarning
AS0087Translations of enum value captions must not contain commasExtensibilityWarning
AS0088Objects with an ID that can be referenced and which have been published must not be deleted.UpgradeError
AS0089Objects that can be referenced and which have been published must not be deleted.UpgradeError
AS0090Objects that can be referenced and which have been published must not be renamed.UpgradeError
AS0091One or more dependencies of the previous version of the extension could not be found.UpgradeError
AS0092The app.json file must specify an Azure Application Insights resource.ConfigurationWarning
AS0094Permission Sets should not be defined in XML files.ConfigurationWarning
AS0095The access modifier of a table field cannot be changed to a value that provides less access.ConfigurationError
AS0096The name of an extension cannot be changed.ConfigurationError
AS0097The publisher name of an extension cannot be changed.ConfigurationError
AS0098An affix is needed.ExtensibilityWarning
AS0099The member ID should be within the allowed rangeExtensibilityInfo
AS0100The 'application' property must be specified in the app.json file.ExtensibilityError
AS0101The 'Isolated' argument cannot be changed, added, or removed.UpgradeError
AS0102Cannot add a return value to a procedureUpgradeError
AS0103Table definitions must have a matching permission set.ConfigurationWarning
AS0104The extension name is not valid.ExtensibilityError
AS0105Object pending obsoletion contains an expired ObsoleteTag.DesignError
AS0106A variable belonging to the public API cannot be removed.DesignError
AS0107The access modifier of a variable that belongs to the public API cannot be changed to a value that provides less access.DesignError
AS0108The type of a variable belonging to the public API cannot be changed.DesignError
AS0109The type of the table has changed from Normal to Temporary.UpgradeWarning
AS0110Permission set extensions should not include permissions for objects defined in another application.ExtensibilityWarning
AS0111Permission set extensions should not include permission sets defined in another application.ExtensibilityWarning
AS0112Permission set extensions should not include permission sets which include permissions for objects defined in another application.ExtensibilityWarning
AS0113Permission set extensions should not include wildcard permissions.ExtensibilityWarning
AS0114The name of an external business event cannot be changed.UpgradeError
AS0115The obsolete state cannot change directly from 'No' to 'Removed'.UpgradeError
AS0116Source application for the moved symbol cannot be found.UpgradeWarning
AS0117Application object is moved without the use of PendingMove.UpgradeError
AS0118The length of a field part of the primary key cannot change.UpgradeError
AS0119The value of the MovedTo property in the source symbol does not match the destination AppId.UpgradeError
AS0120The value of the MovedFrom property in the destination object does not match the source AppId.UpgradeError
AS0121When a symbol is moved the name must remain the same.UpgradeError
AS0122Source symbol for the moved symbol cannot be found in the package with the given AppId.UpgradeWarning
AS0123A key cannot be declared as clustered on an existing table.UpgradeError
AS0124Changing an extension object's target is not allowed.UpgradeError
AS0125Changes the XLIFF translation ID are not allowed.UpgradeInfo
AS0126InternalsVisibleTo should not specifying a different publisher name than the one of this extension.ExtensibilityWarning
AS0127Objects should be placed in a namespace with at least two levels.ExtensibilityWarning
AS0128An interface must not be removed from the the list of extended interfaces on an interface that has been published.UpgradeError
AS0129An interface must not be added to the the list of extended interfaces on an interface that has been published.UpgradeError
AS0130Avoid using duplicate object namesExtensibilityWarning
AS0131Tables with schema should not be added.UpgradeHidden
AS0132Fields with schema should not be added.UpgradeHidden
AS0133Keys should not be added.UpgradeHidden
AS0134The version of an external business event cannot be changed.UpgradeWarning
AS0135External business events must be marked obsolete before they can be removed.UpgradeError
AS0136Field IDs can only be changed with proper obsoletion.UpgradeWarning
AS0137The ID of fields in the primary key cannot change.UpgradeError
AS0138Table fields should use the AllowInCustomizations propertyExtensibilityHidden
AS0139New table fields must use the AllowInCustomizations propertyUpgradeWarning
AS0140Analysis views that have been published must not be deleted.UpgradeError
AS0141A table that appears to be moved from another app must have the MovedFrom property.UpgradeError
AS0142The destination table must have the MovedFrom property.UpgradeError
AS0146Changing a field from Integer to BigInteger may break dependent extensions.UpgradeWarning
AS0147Changing a parameter from Integer to BigInteger might break dependent extensions.UpgradeWarning
AS0148An interface method was made required without first being marked [RequiredPending].UpgradeError
AS0149Adding or removing a required method on an interface may break dependent extensions at runtime.UpgradeWarning
AS0150Fully-namespaced app objects must be in a compliant namespaceExtensibilityError
AS0151FullNamespaceScope conflicts with mandatory affix configurationExtensibilityInfo
AS0152Removing a codeunit used as a default implementation is a runtime breaking change.UpgradeWarning

Note


Several rules enforced by the AppSourceCop analyzer are incompatible with rules enforced by the PerTenantExtensionCop. Make sure to enable only one of these at a time.

Note


Failing to comply with the rules whose default severity is set to Error will fail the submission of your extension to the AppSource marketplace. It is recommended, but not mandatory to comply with the rules whose severity is marked as Warning or Info. Rules with severity Hidden are related to very specific use cases and can be ignored.

Configuration

The AppSourceCop analyzer can be further configured by adding a file named AppSourceCop.json in the project's root folder. The AL Language extension will offer IntelliSense for this file.

The following table describes the settings in the AppSourceCop.json file:

SettingMandatoryValue
nameNoThe name of a previous version of this package with which you want to compare the current package for breaking changes.
publisherNoThe publisher of a previous version of this package with which you want to compare the current package for breaking changes.
versionYesThe version of a previous version of this package with which you want to compare the current package for breaking changes.
mandatoryAffixesNoAffixes that must be prepended or appended to the name of all new application objects, extension objects, and fields.
supportedCountriesNoThe set of country codes, in the alpha-2 ISO 3166 format, in which the application will be available.
targetVersionNoSpecifies the next Major.Minor version of the extension in the current branch to validate the ObsoleteTag values with AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used. This property is being deprecated in favor of obsoleteTagVersion.
obsoleteTagVersionNoSpecifies the next Major.Minor version of the extension in the current branch to validate the ObsoleteTag values with AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used.
obsoleteTagPatternNoThe Obsolete tag pattern used by AS0076. This should be a valid regular expression. By default, the pattern '(\d+)\.(\d+)' is used.
obsoleteTagPatternDescriptionNoA human-readable description for the ObsoleteTagPattern regular expression. This is used in diagnostics reported by AS0076. By default, 'Major.Minor' is used.
obsoleteTagAllowedVersionsNoA comma-separated list of Major.Minor versions that will be allowed as ObsoleteTag values by AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used.
baselinePackageCachePathNoThe path to the folder containing the baseline and its dependencies with which you want to compare the current package for breaking changes. By default, the package cache path for the current project is used (see 'al.packageCachePath' setting).
obsoleteTagMinAllowedMajorMinorNoThe minimum version of ObsoleteTag (Major.Minor) allowed during compilation. Referencing an obsolete pending object with an obsolete tag lower than the specified version will trigger the rule AS0105. Note that enabling this setting has a performance impact.
sourceMovedObjectsPackagesCachePathNoThe path to the folder containing the packages from which tables or fields are moved to the current application. It should also contain their dependencies. If empty, move validation is disabled.
validateInternalSymbolsNoSpecifies whether the breaking change validation should be enabled on internal symbols. By default, the validation of breaking changes is performed only on symbols that are part of the public API (except for schema breaking change validation which is always performed).
validateObsoleteSymbolsNoSpecifies whether the breaking change validation should be enabled on symbols which are obsolete in the baseline. By default, the validation of breaking changes allows breaking change done on symbols which are obsolete in the baseline (except for schema breaking change validation which is always performed).
validateOnPremSymbolsNoSpecifies whether the breaking change validation should be enabled on OnPrem symbols. By default, the validation of breaking changes is generally performed only on symbols with scope Cloud (except for schema breaking change validation which is always performed).

The name, publisher, version properties are used for specifying a previous version of the current package. This package must be located in the baseline package cache folder of your extension. This cache can be specified using the baselinePackageCachePath property. If this property is not specified, the dependency package cache path of the extension will be used instead. The al.packageCachePath setting allows you to specify the path to the folder that will act as the cache for the dependencies symbol files used by your project. AppSourceCop will compare the previous version of your extension with its current version and will report any breaking changes introduced by the current package.

The mandatoryAffixes property specifies strings that must be prepended or appended to the names of all new objects, extension objects and fields. By using these affixes, you can prevent clashes between objects added by your extension and objects added by other extensions.

The supportedCountries property specifies the codes that correspond to the countries/regions for which the product allows AppSource submissions. For more information, see Availability and supported Countries/Regions and Translations

The properties obsoleteTagVersion, obsoleteTagPattern, and obsoleteTagPatternDescription can be used to enable additional validation on object obsoletion. These are not required for AppSource submissions.

Example

In the following example, we will configure AppSourceCop to validate that all new elements have a name that contains one of the specified affixes.

Note


Make sure that code analysis is enabled and ${AppSourceCop} is specified in the list of enabled code analyzers. For more information see AL Language Extension Configuration.

We start by creating the default "Hello world" extension.

pageextension 50100 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage();
    begin
        begin
            Message('App published: Hello world');
        end;
    end;
}

We continue by adding the configuration file AppSourceCop.json in the project's root folder and setting its content to the following.

{
    "mandatoryAffixes": [ "Foo", "Bar" ]
}

Important


If you are running a multi-root workspace environment, you must have one AppSourceCop.json file in the root folder of each of the projects. For more information, see Working with multiple AL project folders within one workspace.

You are immediately greeted by the following error message:

AS0011: The identifier 'CustomerListExt' must have at least one of the mandatory affixes 'Foo, Bar'.

Prepending Foo to the name of the page extension object will fix this error and prevent clashes between this page extension and page extensions added by other developers.

Note


It is still possible to use the mandatoryPrefix and mandatorySuffix properties in the AppSourceCop.json. For more information see AS0011.

Using the Code Analysis Tool
Ruleset for the Code Analysis Tool
Using the Code Analysis Tools with the Ruleset