AL icon indicating copy to clipboard operation
AL copied to clipboard

ErrorBehaviour attribute cancels CommitBehaviour attribute

Open JosefKainzSHB opened this issue 8 months ago • 2 comments

1. Describe the bug When a function with the ErrorBehaviour attribute is invoked in a function with the CommitBehaviour attribute, the CommitBehaviour doesnt apply anymore.

2. To Reproduce

Commit throws an error

    [CommitBehavior(CommitBehavior::Error)]
    local procedure ErrorCommit()
    begin
        NormalFunction();
        Commit();
    end;

    local procedure NormalFunction()
    begin
    end;

Commit doesn't throw an error anymore

    [CommitBehavior(CommitBehavior::Error)]
    local procedure ErrorCommit()
    begin
        ErrorBehaviorFunction();
        Commit();
    end;

    [ErrorBehavior(ErrorBehavior::Collect)]
    local procedure ErrorBehaviorFunction()
    begin
    end;

3. Expected behavior The commit should throw an error because of the CommitBehaviour attribute.

4. Actual behavior The commit doesn't throw an error.

5. Versions:

  • AL Language: 16.3.2065053
  • Visual Studio Code: 1.111.0
  • Business Central: 27.4
  • Operating System: [x] Windows [ ] Linux [ ] MacOS

JosefKainzSHB avatar Mar 16 '26 12:03 JosefKainzSHB

Great question, I've forwarded it to our runtime experts. It is not part of the issues we normally handle here but I'll leave it open for a bit. Perhaps we can get some clarity on the expected behavior.

SBalslev avatar Mar 18 '26 07:03 SBalslev

Thank you for the bug report, I have identified the root cause, and a fix will be rolled out to all supported versions. (Internal bug ID AB#625959)

jehelles avatar Mar 18 '26 13:03 jehelles