Skip to content

Missing compiler error when assigning a Variant to a RecordRef #8239

@NKarolak

Description

@NKarolak

1. Describe the bug
Since BC 26 / runtime 15.2, an implicit conversion between Record and RecordRef is supported.

The compiler now allows us also to assign a (record based) variant to RecRef:
RecRef := SomeVariant;
But this will result in a runtime error:
The expression Microsoft.Dynamics.Nav.Runtime.NavIndirectValue cannot be type-converted to a Microsoft.Dynamics.Nav.Runtime.NavRecordRef value.

2. To Reproduce
Steps to reproduce the behavior:

Add assignment like RecRef := SomeVariant;.
Then run the code in the web client.

3. Expected behavior
Error in the AL compiler for the RecRef := SomeVariant; line, no publish possible.

4. Actual behavior
Error in the web client, which is too late.

5. Versions:

  • AL Language: v17.0.2273547
  • Business Central: 27.1
    Internal work item: AB#634365

Metadata

Metadata

Assignees

Labels

acceptedal-core-compilerbugProduct bugplatform-apiIssue related to the API exposed by the platform through the AL library.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions