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
733
stars
243
forks
source link
A `[TryFunction]` that implements an interface returns wrong values #7558
1. Describe the bug
When a [TryFunction] implements an interface that requests a function that returns a Boolean, the return value, when used through the interface does not return the correct value.
2. To Reproduce
Create the following interface:
interface ITest
{
procedure DoTest(): Boolean;
}
Create the following Codeunit that implements this interface
Note that DoTest does not explicitly return a value here, even though this is requested by the interface. Being a [TryFunction] though, this implicitly is the case and as such this compiles without problems.
Also note that DoTest does nothing and as such cannot raise an exception. This in turn means that the function must return true, being a [TryFunction].
1. Describe the bug When a
[TryFunction]
implements an interface that requests a function that returns a Boolean, the return value, when used through the interface does not return the correct value.2. To Reproduce Create the following interface:
Create the following Codeunit that implements this interface
Note that
DoTest
does not explicitly return a value here, even though this is requested by the interface. Being a[TryFunction]
though, this implicitly is the case and as such this compiles without problems.Also note that
DoTest
does nothing and as such cannot raise an exception. This in turn means that the function must returntrue
, being a[TryFunction]
.Create the following test codeunit:
The assertion "Codeunit failed" does not fail - this is expected The assertion "Interface failed" on the other hand does.
3. Expected behavior I expect one of two things:
[TryFunction]
is not a suitable implementationtrue
orfalse
correctly, according to if an error occurred or not.4. Actual behavior You can run the test codeunit and see what happens.
5. Versions: