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
728 stars 241 forks source link

Object name in event subscriber #7609

Closed rkirsten closed 8 months ago

rkirsten commented 8 months ago

1. Describe the bug Since AL Language extension v13.0.903630 using the Find Event action produces a procedure name such as "(<ObjectType> <Object Name without quotes>) <EventName>[ - <Optional field name>]" wrapped in quotes as proposed in that issue of this repo.

In the Best Practices for AL - Method Section the usage of Pascal case was proposed but excluded as mandatory. However, in Best Practices for AL - Variable and field naming it is.

I am fully aware that this is not a bug, since code compiles. I would rate this buggish. In terms of consistency, readability and conformity with the guidelines/styleguides, I very much would like to propose Pascal Case also in the procedure name within the eventsubscriber as well.

2. To Reproduce Use action Find Event and search for an event (e.g. OnAfterReleaseServiceDoc). Add the subscriber to a codeunit.

3. Expected behavior

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Release Service Document", OnAfterReleaseServiceDoc, '', false, false)]
local procedure ReleaseServiceDocument_OnAfterReleaseServiceDoc(var ServiceHeader: Record "Service Header");
begin
end;

4. Actual behavior

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Release Service Document", OnAfterReleaseServiceDoc, '', false, false)]
local procedure "Release Service Document_OnAfterReleaseServiceDoc"(var ServiceHeader: Record "Service Header");
begin
end;

5. Versions:

BazookaMusic commented 8 months ago

The problem is that then you can get duplicate methods because of two objects differing in name only by whitespace. For example, if you have a codeunit "SalesOrders" in one package and a codeunit "SalesOrders" in another package, you will get a clash for one of the two.

I will let the team decide here, but since this is naming, I doubt there's a solution that will fit everyone.

PooyaKharamesh commented 8 months ago

Great idea! Go ahead and post this to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.

rkirsten commented 8 months ago

The problem is that then you can get duplicate methods because of two objects differing in name only by whitespace. For example, if you have a codeunit "SalesOrders" in one package and a codeunit "SalesOrders" in another package, you will get a clash for one of the two.

With the introduction of namespaces this could happen by design. Also with the current naming. Or do I miss something? Thanks anyway for considering. I will try at BC Ideas.