{"title":"AppSourceCop Error AS0018","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0018/","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-as0018, 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-as0018","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":"A procedure that belongs to the public API cannot be removed, because it will break dependent extensions calling this procedure.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0018","slug":"appsourcecop-error-as0018","at":0,"chars":3458},{"level":2,"title":"Description","slug":"description","at":86,"chars":144},{"level":2,"title":"Remarks","slug":"remarks","at":230,"chars":378},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":608,"chars":387},{"level":2,"title":"Code examples triggering the rule","slug":"code-examples-triggering-the-rule","at":995,"chars":1384},{"level":3,"title":"Example 1 - Removing a public procedure","slug":"example-1---removing-a-public-procedure","at":1032,"chars":747},{"level":3,"title":"Example 2 - Renaming a public procedure","slug":"example-2---renaming-a-public-procedure","at":1779,"chars":600},{"level":2,"title":"Code examples not triggering the rule","slug":"code-examples-not-triggering-the-rule","at":2379,"chars":932},{"level":3,"title":"Example 1 - Removing a local procedure","slug":"example-1---removing-a-local-procedure","at":2420,"chars":399},{"level":3,"title":"Example 2 - Renaming an internal procedure","slug":"example-2---renaming-an-internal-procedure","at":2819,"chars":492},{"level":2,"title":"Related information","slug":"related-information","at":3311,"chars":147}],"text":"# AppSourceCop Error AS0018\nA procedure belonging to the public API cannot be removed\n## Description\nA procedure that belongs to the public API cannot be removed, because it will break dependent extensions calling this procedure.\n## Remarks\nRemoving or renaming a procedure that belongs to the public API is not allowed, because it will break dependent extensions which are referencing it. It is allowed to remove or rename local or internal procedures.\n> NOTE\n> Internal procedures are also available for the modules specified in the internalsVisibleTo property in your app.json<../devenv-json-files> file.\n## How to fix this diagnostic?\nReverting the change will fix this diagnostic. If removing or renaming the procedure is required, the recommended approach is to mark the procedure with the ../attributes/devenv-obsolete-attribute attribute. In a future version, once all dependent extensions have updated their code to not reference the obsolete procedure, you can remove it or rename it.\n## Code examples triggering the rule\n### Example 1 - Removing a public procedure\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n}\n```\nIn version 2.0, the public procedure MyProcedure has been removed. If a dependent extension referenced this procedure, this will lead to a compilation error similar to `The name 'MyProcedure' does not exist in the current context (AL0118)`.\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 AnotherMethod()\n    var\n        c: Codeunit MyCodeunit;\n    begin\n        c.MyProcedure();\n    end;\n}\n```\n### Example 2 - Renaming a public procedure\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n        // Business logic\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyRenamedProcedure()\n    begin\n        // Business logic\n    end;\n}\n```\nIn version 2.0, the public procedure MyProcedure has been renamed to MyRenamedProcedure. If a dependent extension referenced this procedure, this will lead to a compilation error similar to `The name 'MyProcedure' does not exist in the current context (AL0118)`.\n## Code examples not triggering the rule\n### Example 1 - Removing a local procedure\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    local procedure MyProcedure()\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n}\n```\nIn version 2.0, the local procedure MyProcedure has been removed. This is not a breaking change because this procedure couldn't be referenced by other extensions.\n### Example 2 - Renaming an internal procedure\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    internal procedure MyProcedure()\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    internal procedure MyRenamedProcedure()\n    begin\n    end;\n}\n```\nIn version 2.0, the public procedure MyProcedure has been renamed to MyRenamedProcedure. This is not a breaking change because this procedure couldn't be referenced by other extensions.\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}