{"title":"Compiler Error AL0921","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/diagnostics/diagnostic-al921/","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/diagnostics/diagnostic-al921, 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/diagnostics/diagnostic-al921","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":"The method '{0}' cannot be used as the implementation for the interface method '{1}' because it is not public.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Compiler Error AL0921","slug":"compiler-error-al0921","at":0,"chars":1972},{"level":2,"title":"Description","slug":"description","at":493,"chars":193},{"level":2,"title":"Remarks","slug":"remarks","at":686,"chars":336},{"level":2,"title":"How to fix it","slug":"how-to-fix-it","at":1022,"chars":130},{"level":2,"title":"Example of code that triggers AL0921","slug":"example-of-code-that-triggers-al0921","at":1152,"chars":344},{"level":2,"title":"Example of how to fix it","slug":"example-of-how-to-fix-it","at":1496,"chars":292},{"level":2,"title":"Related information","slug":"related-information","at":1788,"chars":184}],"text":"# Compiler Error AL0921\n> NOTE\n> The AL diagnostics topics are in preview. If you have input for this topic, we'd love to hear from you. Use our GitHub repo to create a PR and add content to this topic by going to https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb. To read about contributing, see Contribute to the Help<../../help/contributor-guide#contributing>. Thanks!\nThe method '{0}' cannot be used as the implementation for the interface method '{1}' because it is not public.\n## Description\nInterface implementations must be publicly accessible because interfaces can be invoked across module boundaries. Non-public methods will not be dispatched correctly at runtime.\n## Remarks\nInterface methods are called through an interface variable, which can be passed across module boundaries. The implementing method must be public so that the runtime can dispatch the call correctly. This error is the enforcement version of warning AL0920<diagnostic-al920>, which was introduced in an earlier runtime version.\n## How to fix it\nChange the accessibility of the implementing method to public by removing the local or internal access modifier.\n## Example of code that triggers AL0921\n```al\ninterface IValidator\n{\n    procedure Validate(input: Text): Boolean;\n}\n\ncodeunit 50100 MyValidator implements IValidator\n{\n    // Error: internal method cannot implement an interface method.\n    internal procedure Validate(input: Text): Boolean;\n    begin\n        exit(input <> '');\n    end;\n}\n```\n## Example of how to fix it\nMake the implementing method public.\n```al\ninterface IValidator\n{\n    procedure Validate(input: Text): Boolean;\n}\n\ncodeunit 50100 MyValidator implements IValidator\n{\n    procedure Validate(input: Text): Boolean;\n    begin\n        exit(input <> '');\n    end;\n}\n```\n## Related information\nGetting started with AL<../devenv-get-started>\nDeveloping extensions<../devenv-dev-overview>\n../devenv-interfaces-in-al\nCompiler Warning AL0920<diagnostic-al920>"}