Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
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 here. To read about contributing, see Contribute to the Help. Thanks!
The method '{0}' cannot be used as the implementation for the interface method '{1}' because it is not public.
Important
This warning will become an error with Business Central 2027 release wave 1.
Description
Interface implementations must be publicly accessible because interfaces can be invoked across module boundaries. Non-public methods will not be dispatched correctly at runtime.
Remarks
This diagnostic is currently a warning but will become an error in a future version (runtime 17.0 / Spring 2027). Interface methods are called through an interface variable, which can be passed across module boundaries. If the implementing method is local or internal, the runtime cannot always dispatch the call correctly.
Important
This warning will become error AL0921 in a future runtime version. Update your code now to avoid a breaking change.
How to fix it
Change the accessibility of the implementing method to public by removing the local or internal access modifier.
Example of code that triggers AL0920
interface IMyInterface
{
procedure Calculate(): Integer;
}
codeunit 50100 MyCodeunit implements IMyInterface
{
// This triggers AL0920 because the method is local,
// but it implements an interface method that must be public.
internal procedure Calculate(): Integer;
begin
exit(42);
end;
}
Example of how to fix it
Make the implementing method public.
interface IMyInterface
{
procedure Calculate(): Integer;
}
codeunit 50100 MyCodeunit implements IMyInterface
{
procedure Calculate(): Integer;
begin
exit(42);
end;
}
Related information
Getting started with AL
Developing extensions
Interfaces in AL
Compiler Error AL0921