AL icon indicating copy to clipboard operation
AL copied to clipboard

AA0136 not works together with ErrorBehavior(ErrorBehavior::Collect)

Open TKapitan opened this issue 3 years ago • 0 comments

1. Describe the bug Writing second article about CollectibleErrors & ErrorInfo datatype and found AA0136 (unreachable code detection) does not work as intended - it warns that anything after the first error is not accessible even if the code is accessible due to ErrorBehavior(ErrorBehavior::Collect) setting.

2. To Reproduce Steps to reproduce the behavior:

    [ErrorBehavior(ErrorBehavior::Collect)]
    local procedure Error4()
    begin
        Error(ErrorInfo.Create('Test error 4', true));
        Error(ErrorInfo.Create('Test error 5', true));

        /*
        Multiple errors occurred during the operation the first of which is: Test error 4. All errors can be found under 'Detailed Information'.

        Test error 4
        Test error 5

        (details removed as it's not important for this error)
        */
    end;

3. Expected behavior Both Errors are executed so the warning about unreachable code should not be shown.

4. Actual behavior The second line contains warning "Unreachable code detected. [AA0136]"

TKapitan avatar Jul 15 '22 08:07 TKapitan