microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
722 stars 242 forks source link

AL0749 misses internal/local IntegrationEvent triggers #7635

Closed bjarkihall closed 5 months ago

bjarkihall commented 6 months ago

1. Describe the bug Compiler warning AL0749 prevents solutions from exposing public procedures which have internal objects exposed as parameters, this is useful since extensions wouldn't be able to use the procedure either way.

However, IntegrationEvent usually has local/internal procedure for the trigger of the event, since it allows subscriptions but prevents others from triggering the event (it also enables developers to add missing parameters to existing events).

For more information about the rule: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al749

The type '{0}' of the parameter '{1}' of the {2} method '{3}' has 'Internal' accessibility. The method will not be callable outside of this module without an implicit conversion.

I believe skipping local/internal IntegrationEvent procedures might be an oversight, since we wouldn't want to expose unusable public events.

2. To Reproduce Here's a minimal reproduction:

codeunit 50000 MyPublicCodeunit
{
    [IntegrationEvent(false, false)]
    internal procedure OnBeforeFoo(var MyInternalEnum: Enum MyInternalEnum);
    begin
    end;
}
enum 50000 MyInternalEnum
{
    Access = Internal;
    Extensible = False;
    value(0; "None") { }
}

3. Expected behavior I expect the compiler to catch this case and raise a warning, since it renders the events useless for extensions.

4. Actual behavior No warning is raised if it's internal procedure but it's raised if it's just procedure (public).

5. Versions:

Note: Our build server uses alc.exe and fails to catch these too, so it doesn't seem to relate to vscode.

Final Checklist

Please remember to do the following:

BazookaMusic commented 6 months ago

This is missing from the rule, so it is a bug. Marking it for triage

dannoe commented 6 months ago

This is somehow related to #7614, isn't it?

JesperSchulz commented 5 months ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 24.0.15860.0 and VS Code Extension Version 13.0.935369.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/