{"title":"AppSourceCop Error AS0024","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0024/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/appsourcecop-as0024, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/appsourcecop-as0024","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Parameters cannot be removed or added in external procedures, because it will break dependent extensions.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0024","slug":"appsourcecop-error-as0024","at":0,"chars":3217},{"level":2,"title":"Description","slug":"description","at":89,"chars":121},{"level":2,"title":"Remarks","slug":"remarks","at":210,"chars":145},{"level":2,"title":"Code examples triggering the rule","slug":"code-examples-triggering-the-rule","at":355,"chars":1604},{"level":3,"title":"Example 1 - Removing parameters","slug":"example-1---removing-parameters","at":392,"chars":741},{"level":3,"title":"Example 2 - Adding new parameters","slug":"example-2---adding-new-parameters","at":1133,"chars":826},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":1959,"chars":1111},{"level":3,"title":"Example - Adding a parameter to a public procedure","slug":"example---adding-a-parameter-to-a-public-procedure","at":2326,"chars":744},{"level":2,"title":"Related information","slug":"related-information","at":3070,"chars":147}],"text":"# AppSourceCop Error AS0024\nParameters cannot be removed or added in external procedures\n## Description\nParameters cannot be removed or added in external procedures, because it will break dependent extensions.\n## Remarks\nIt's not allowed to remove or add new parameters in public procedures as this will break dependent extensions which are calling them.\n## Code examples triggering the rule\n### Example 1 - Removing parameters\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure(i: Integer)\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nIn version 2.0, the parameter i of the procedure has been removed. If a dependent extension calls this procedure, this will lead to a compilation error similar to `No overload for method 'MyProcedure' takes 1 argument. (AL0126)`.\nFor example, the following extension compiles when depending on version 1.0, but fails to compile with version 2.0:\n```al\ncodeunit 50120 AnotherCodeunit\n{\n    procedure RaiseEvent()\n    begin\n        MyProcedure(5);\n    end;\n}\n```\n### Example 2 - Adding new parameters\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure(i: Integer)\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure(i: Integer; j: Integer)\n    begin\n    end;\n}\n```\nIn version 2.0, a new parameter j has been added to the procedure. If a dependent extension calls this procedure, this will lead to a compilation error similar to `There is no argument given that corresponds to the required formal parameter 'j' of 'MyProcedure(Integer, Integer)' (AL0135)`.\nFor example, the following extension compiles when depending on version 1.0, but fails to compile with version 2.0:\n```al\ncodeunit 50120 AnotherCodeunit\n{\n    procedure RaiseEvent()\n    begin\n        MyProcedure(5);\n    end;\n}\n```\n## How to fix this diagnostic?\nTo fix this diagnostic, the changes on the procedure signature must be reverted. The procedure should be marked as obsolete, and a new procedure should be introduced.\nThe behavior of the obsoleted procedure should be preserved to not break the runtime behavior of dependent extensions while they have not yet uptaken the new procedure.\n### Example - Adding a parameter to a public procedure\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure(i: Integer)\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    [Obsolete('Use MyProcedure(i: Integer;j: Integer) instead. This method will be removed in version 3.0.', '2.0')]\n    procedure MyProcedure(i: Integer)\n    begin\n    end;\n\n    procedure MyProcedure(i: Integer; j: Integer)\n    begin\n    end;\n}\n```\nOnce dependent extensions have been updated to use the new procedure, the obsolete procedure can be removed.\nVersion 3.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure(i: Integer; j: Integer)\n    begin\n    end;\n}\n```\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}