AppSourceCop Analyzer Rules

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

Rules

Id Title Description MessageFormat Category Default Severity IsEnabledbyDefault
AS0001 Tables and table extensions that have been published must not be deleted. Tables and table extensions that have been published must not be deleted. This might break the upgrade of existing installations and dependent extensions. The {0} with name '{1}' and ID '{2}' was found in the previous version, but is missing in the current extension. This might break the upgrade of existing installations. Upgrade Error true
AS0002 Fields must not be deleted. Fields must not be deleted. This might break the upgrade of existing installations and dependent extensions. The field with name '{0}' and ID '{1}' was found in the previous version, but is missing in the current extension. This might break the upgrade of existing installations. Upgrade Error true
AS0003 The previous version of the extension could not be found. The previous version of the extension, used as a baseline for detecting breaking changes, could not be found in the package cache folder. The version '{0}' of the extension with publisher '{1}' and name '{2}' could not be found in the package cache folder. If you do not want to validate breaking changes, remove the property 'version' from the AppSourceCop.json. Upgrade Error true
AS0004 Fields must not change type, since dependent extensions may break Fields must not change type. Field '{0}' has changed type from '{1}' to '{2}'. Type changes are not allowed. Upgrade Error true
AS0005 Fields must not change name Fields must not change name. This might break the upgrade of existing installations and dependent extensions. The field with ID '{0}' was renamed from '{1}' to '{2}'. Name changes are not allowed because this might break upgrade of existing installations. Upgrade Error true
AS0006 Tables that have been published must not change name. Tables that have been published must not change name. This might break the upgrade of existing installations and dependent extensions. The table with ID '{0}' was renamed from '{1}' to '{2}'. Name changes are not allowed because this might break upgrade of existing installations. Upgrade Error true
AS0007 Properties must not change value. Properties must not change value. This might break the upgrade of existing installations and dependent extensions. The property '{0}' has changed value. Value change is not allowed for this property. Upgrade Error true
AS0009 Key fields must not be changed Key fields must not be changed. The field list for key '{0}' has changed from '{1}' to '{2}'. Changes to the field list are not allowed as that might break upgrade of existing installations. Upgrade Error true
AS0010 Keys must not be deleted, since dependent extensions may break The primary key must not be deleted. Key '{0}' has been deleted. The primary key may not be deleted. Upgrade Error true
AS0011 An affix is required An affix is required. The identifier '{0}' must have at least one of the mandatory affixes '{1}'. Extensibility Error true
AS0013 The field identifier must be within the allowed range The field identifier must be within the allowed range and outside the range allocated to per-tenant customizations. The field identifier '{0}' is not valid. It must be within the range '{1}', which is allocated to the application, and outside the range '{2}', which is allocated to per-tenant customizations . Extensibility Error true
AS0014 The project manifest must contain the allocated identifier range The project manifest must contain the allocated identifier range. The project manifest must contain the allocated identifier range. Extensibility Error true
AS0015 TranslationFile must be enabled. The "TranslationFile" flag must be added to the "features" array in the app.json file. The "TranslationFile" flag must be added to the "features" array in the app.json file. Extensibility Error true
AS0016 Fields of field class 'Normal' must use the DataClassification property and its value should be different from ToBeClassified Fields of field class 'Normal' must use the DataClassification property and its value must be different from ToBeClassified. FlowFields and FlowFilter fields are automatically set to the SystemMetadata data classification. Field with name '{0}' must use the DataClassification property and its value should be different from ToBeClassified. Extensibility Error true
AS0018 A procedure belonging to the public API cannot be removed A procedure that belongs to the public API cannot be removed, because it will break dependent extensions calling this procedure. Procedure '{0}' has been removed in '{1} {2}'. A procedure that belongs to the public API must not be removed as it will break dependent extensions calling this procedure. Upgrade Error true
AS0019 Event attributes cannot be removed Removing Event attributes such as IntegrationEvent or BusinessEvent is not allowed because it will break dependent extensions that have subscribed to this event. An '{0}' attribute has been removed from '{1}'. This is not allowed because it will break dependent extensions that have subscribed to this event. Upgrade Error true
AS0020 The type of events cannot be changed. The event attribute type cannot be changed because it might break dependent extensions. The event attribute cannot be changed from '{0}' to '{1}' on '{2}' because it might break dependent extensions. Upgrade Error true
AS0021 An argument in an event attribute cannot be changed to false. An argument in an event attribute cannot be changed to false. This is not allowed because it may break dependent extensions that have subscribed to this event. The argument '{0}' for the event attribute '{1}' on '{2}' must not be changed to false because it may break dependent extensions that have subscribed to this event. Upgrade Error true
AS0022 An external scope cannot be removed An external scope cannot be removed. The external scope in '{0}' cannot be removed or changed to 'internal' because it will break dependent extensions. Note that adding 'local' overrides the argument in 'Scope'. Upgrade Error true
AS0023 A return type cannot be modified in events and external procedures A return type cannot be modified in events and external procedures. The return type in '{0}' has changed from '{1}' to '{2}'. This will break dependent extensions. Upgrade Error true
AS0024 Parameters cannot be removed or added in external procedures Parameters cannot be removed or added in external procedures, because it will break dependent extensions. The number of parameters in the external procedure '{0}' has changed from '{1}' to '{2}'. This will break dependent extensions. Upgrade Error true
AS0025 Parameters cannot be modified, renamed, or removed from events. Parameters cannot be modified, renamed, or removed from Business type and Integration type events, because it will break dependent extensions. The signature of the event '{0}' has changed from '{1}' to '{2}'. This will break dependent extensions subscribing to this event. Upgrade Error true
AS0026 The type and subtype of parameters cannot be modified in events and external procedures The type and subtype of parameters cannot be modified in events and external procedures. The type or subtype of '{0}' has been modified from '{1}' to '{2}'. This is not allowed in events and external procedures because it will break dependent extensions. Upgrade Error true
AS0027 Modifying the array size of a parameter in events and external procedures is not allowed Modifying the array size of a parameter in events and external procedures is not allowed. The array size of a parameter in '{0}' has been modified, this should be avoided in events and external procedures. Upgrade Error true
AS0028 Reducing the array size of a parameter in events and external procedures is not allowed Reducing the array size of a parameter in events and external procedures is not allowed. The array size of a parameter in '{0}' has been reduced, this should be avoided in events and external procedures. Upgrade Error true
AS0029 Pages and PageExtensions that have been published must not be deleted, since dependent extensions may break Pages and PageExtensions that have been published must not be deleted. The {0} with name '{1}' and ID '{2}' was found in the previous version, but is missing in the current extension. This will break dependent extensions. Upgrade Error true
AS0030 Pages that have been published must not be renamed. Pages that have been published must not be renamed because it will break dependent extensions. The {0} with name '{1}' and ID {2} has been renamed to '{3}'. Name changes are not allowed because this will break dependent extensions. Upgrade Error true
AS0031 Actions that have been published must not be deleted. Actions that have been published must not be deleted, because it will break dependent extensions. The action with name '{0}' defined in {1} '{2}' was found in the previous version, but is missing in the current extension. This will break dependent extensions. Upgrade Error true
AS0032 Controls that have been published must not be deleted/ Controls that have been published must not be deleted, because it will break dependent extensions. The control with name '{0}' defined in {1} '{2}' was found in the previous version, but is missing in the current extension. This will break dependent extensions. Upgrade Error true
AS0033 Views that have been published must not be deleted. Views that have been published must not be deleted, because it will break dependent extensions. The view with name '{0}' defined in {1} '{2}' was found in the previous version, but is missing in the current extension. This will break dependent extensions. Upgrade Error true
AS0034 Property changes that cause destructive changes are not allowed Destructive table properties that have been published must not be modified. Property '{0}' has changed value from '{1}' to '{2}', this is a destructive change. Upgrade Error true
AS0036 Property changes that cause destructive changes are not allowed Destructive field properties that have been published must not be modified. Property '{0}' has changed value from '{1}' to '{2}', this is a destructive change. Upgrade Error true
AS0038 Property changes that cause destructive changes are not allowed Destructive key properties that have been published must not be modified. Property '{0}' has changed value from '{1}' to '{2}', this is a destructive change. Upgrade Error true
AS0039 Removing properties that cause destructive changes is not allowed Destructive table properties that have been published must not be removed. Property '{0}' has been removed, this is a destructive change. Upgrade Error true
AS0041 Table field property changes that cause destructive changes must not be removed Table field property changes that cause destructive changes must not be removed. Property '{0}' has been removed, this is a destructive change. Upgrade Error true
AS0042 Table key property changes that cause destructive changes must not be removed Table key property changes that cause destructive changes must not be removed. Property '{0}' has been removed, this is a destructive change. Upgrade Error true
AS0043 Unique keys must not be deleted Unique keys must not be deleted. Key '{0}' has been deleted. Unique key deletions are not allowed. Upgrade Error true
AS0044 Property changes that cause destructive changes are not allowed Destructive field properties that have been published must not be modified. OptionMembers has changed value from '{0}' to '{1}', this is a destructive change, only appending new OptionMembers is allowed. Upgrade Error true
AS0047 The extension name is too long. The extension name length must not exceed the limit of 50 characters. The length of the extension name must not exceed 50 characters. Extensibility Error true
AS0048 The publisher name is too long. The extension publisher length must not exceed the limit of 50 characters. The length of the extension publisher must not exceed 50 characters. Extensibility Error true
AS0049 The access modifier of an application object cannot be changed to a value that provides less access The access modifier of an application object cannot be changed to a value that provides less access. The access modifier of the {0} '{1}' cannot be changed to a value that provides less access. Extensibility Error true
AS0050 The extensibility of an application object cannot be removed The extensibility of an application object cannot be removed. The {0} '{1}' was extensible in the previous version of the extension, but is not in the current version. This might break dependent extensions. Set the value of the 'Extensible' property to 'true'. Extensibility Error true
AS0051 Manifest property is required for AppSource submission The manifest property must be specified and contain a meaningful value. The value of the property might be displayed to users in the AppSource marketplace. The manifest property '{0}' must be specified and contain a meaningful value. Extensibility Error true
AS0052 The property 'url' must be set to a valid URL The property 'url' must be set to a valid URL. The property 'url' must be set to a valid URL. Extensibility Error true
AS0053 The compilation target of an application must be a value that is allowed in a multi-tenant SaaS environment The compilation target of an application must be a value that is allowed in a multi-tenant SaaS environment. The compilation target is set to '{0}', but it must be set to 'Cloud' or 'Extension'. Extensibility Error true
AS0054 The AppSourceCop configuration must specify the set of affixes used by the application The AppSourceCop configuration must specify one of the following properties: 'mandatorySuffix', 'mandatoryPrefix', or 'mandatoryAffixes'. The use of these affixes is validated by the AppSourceCop analyzer and helps prevent conflicts between different AppSource applications. The AppSourceCop configuration must specify one of the following properties: 'mandatorySuffix', 'mandatoryPrefix', or 'mandatoryAffixes' Configuration Error true
AS0055 The AppSourceCop configuration must specify the list of countries targeted by the application The AppSourceCop configuration must specify the list of countries targeted by the application. The AppSourceCop configuration must specify the list of countries targeted by the application by using the 'supportCountries' property. Configuration Hidden true
AS0056 The country codes specified in the 'supportedCountries' property must be valid ISO 3166-1 alpha-2 codes The country codes specified in the 'supportedCountries' property must be valid ISO 3166-1 alpha-2 codes. Each country code must correspond to a country for which the product allows AppSource submissions. See Country/Regional availability and Supported Translations for more information. The code '{0}' is not a valid ISO 3166-1 alpha-2 code for a country supported by the product. Configuration Warning true
AS0057 Translations must be provided for all the locales in which the application will be available Translations must be provided for all the locales in which the application will be available. Translations must be provided for the following language codes: {0}. Add a translation file for them or remove them from the list of supported countries in the AppSourceCop.json file. Extensibility Hidden true
AS0058 Only use AssertError in Test Codeunits Only use AssertError in Test Codeunits. Only use AssertError in Test Codeunits. Extensibility Error true
AS0059 Reserved database tables are read-only in a multi-tenant environment Application database tables and reserved application tables should be used only as temporary tables in a multi-tenant environment. Writing to these tables can lead to runtime errors or unexpected behavior. The table '{0}' cannot be modified because it is part of the read-only application database or because it will result in undefined behavior. Extensibility Error true
AS0060 Unsafe methods cannot be invoked in an AppSource application The method cannot be invoked in an AppSource application because it can lead to runtime errors or undefined behavior. The method '{0}' cannot be invoked in an AppSource application. Extensibility Error true
AS0061 Procedures must not subscribe to CompanyOpen events Procedures must not subscribe to CompanyOpen events because it can increase the login time for Dynamics 365 Business Central. Procedure '{0}' cannot subscribe to '{1}' because it can increase the login time for Dynamics 365 Business Central. Extensibility Error true
AS0062 Page controls and actions must use the ApplicationArea property Page controls and actions must use the ApplicationArea property to be visible to users. {0} '{1}' must have a value for the ApplicationArea property so that they are visible to users. Extensibility Error true
AS0063 Removing a var modifier in events is not allowed Removing a var modifier on a parameter in an event is not allowed as it will break dependent extensions subscribing to it. The var modifier has been removed on the parameter '{0}' in the event '{1}'. This will break dependent extensions subscribing to this event. Upgrade Error true
AS0064 Interface implementations that have been published must not be deleted. An interface implementation that has been published must not be deleted, because dependent extensions may break. Implementation of interface '{0}' has been deleted. Upgrade Error true
AS0065 Interfaces that have been published must not be deleted. An interface that has been published must not be deleted, because dependent extensions may break. Interface '{0}' has been deleted. Upgrade Error true
AS0066 A new method to an interface that has been published must not be added. A new method to an interface that has been published must not be added, because dependent extensions may break Procedure '{0}' has been added in '{1} {2}'. A procedure must not be added to a public API. Upgrade Error true
AS0067 Adding an interface to an enum that has been published must have a default implementation. Adding an interface to an enum that has been published must have a default implementation, because dependent enum extensions don't implement the new interface and may break. Interface '{0}' has been added to the implemented interfaces by enum '{1}' without adding a default implemention. Upgrade Error true
AS0068 Changing a table extension's target is not allowed. Changing the target of a table extension that has been published is not allowed, because this might break the upgrade of existing installations and dependent extensions. The target table of table extension '{0}' has changed from '{1}' to '{2}'. Changing the target of a table extension that has been published is not allowed, because this might break the upgrade of existing installations. Upgrade Error true
AS0069 An enum field replacing an option field should have at least the same number of members. An enum field replacing an option field should have at least the same number of values as the number of options members defined on the field in the previous version of the extension. Having fewer members might break the upgrade of existing installations and dependent extensions. The enum '{0}' must have at least the same number of values as the number of option member '{1}' defined on field '{2}' in the previous version of the extension (Enum: '{3}' - Option: '{4}'). This is not allowed because this might break upgrade of existing installations and dependent extensions. Upgrade Error true
AS0070 An enum field replacing an option field should preserve the member names. An enum field replacing an option field should preserve the member names. Renaming members might break the upgrade of existing installations and dependent extensions. The option value '{0}' has been renamed to '{1}' in the enum '{2}' for field '{3}'. This is not allowed because this might break upgrade of existing installations and dependent extensions. Upgrade Error true
AS0071 An enum field replacing an option field should preserve the member ordinal values. An enum field replacing an option field should preserve the member ordinal values. Modifying the member ordinal values might break the upgrade of existing installations and dependent extensions. The enum '{0}' does not declare a value with ordinal value '{1}' and name '{2}' anymore. This is not allowed because this might break upgrade of existing installations and dependent extensions may break. Upgrade Error true
AS0072 The ObsoleteTag property and the Tag in the Obsolete attribute must be set to the next release version. The ObsoleteTag property and the Tag in the Obsolete attribute must be set to the next release version (Major.Minor). This rule is only relevant if the Major.Minor format is set. The Obsolete Tag {0} in {1} {2} is not allowed. Expected tag for this branch: {3}. Design Hidden true
AS0073 The ObsoleteTag property and the Tag in the Obsolete attribute must be set. The ObsoleteTag property and the Tag in the Obsolete attribute must be set. The ObsoleteTag property and the Tag in the Obsolete attribute must be set. Design Hidden true
AS0074 The Obsolete Tag must be the same across branches. The Obsolete Tag must be the same across branches. This rule is only relevant only if the Major.Minor format is set. Found Obsolete Tag with value {0} in the baseline and value {1} in currenct branch. Obsolete Tag must be the same across branches. Design Hidden true
AS0075 Obsolete Reason must be set. Obsolete Reason must be set. The {0} {1} must have specified the reason of Obsoletion. Design Warning true
AS0076 Obsolete Tag format. Obsolete Tag must have a specific format. Obsolete Tag must be formated {0}. Current Value: {1} Design Hidden true
AS0077 Adding a var modifier in events is not allowed Adding a var modifier in events is not allowed as it might break the runtime behavior of extensions subscribing to it. A var modifier has been added on the parameter '{0}' in the event '{1}'. This might break the runtime behavior of dependent extensions subscribing to this event. Upgrade Warning true
AS0078 Adding or removing a var modifier in external procedures is not allowed Adding or removing a var modifier in public procedures is not allowed as it might break the runtime behavior of extensions calling it. A var modifier has been added or removed on the parameter '{0}' in the procedure '{1}'. This might break the runtime behavior of dependent extensions calling this procedure. Upgrade Warning true

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.

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:

Setting Mandatory Value
name No The name of a previous version of this package with which you want to compare the current package for breaking changes.
publisher No The publisher of a previous version of this package with which you want to compare the current package for breaking changes.
version Yes The version of a previous version of this package with which you want to compare the current package for breaking changes.
mandatoryAffixes No Affixes that must be prepended or appended to the name of all new application objects, extension objects, and fields.
supportedCountries No The set of country codes, in the alpha-2 ISO 3166 format, in which the application will be available.

The name, publisher, version properties are used for specifying a previous version of the current package. This package must be located in the package cache folder of your extension. The al.packageCachePath setting allows you to specify the path to a folder that will act as the cache for the 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 for which the product allows AppSource submissions. For more information, see Availability and supported Countries/Regions and Translations

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.

See Also

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