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
732 stars 243 forks source link

Usage of SystemId in SubPageLink will crash the client #5696

Closed hougaard closed 4 years ago

hougaard commented 4 years ago

If you have a sub-table with a field that holds the SystemId from a parent table, it's not possible to create a ListPart that uses SubPageLink to filter the listpart.

Trace: Type: System.Collections.Generic.KeyNotFoundException Message: The given key was not present in the dictionary. StackTrace: at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Microsoft.Dynamics.Nav.Client.DataBinder.NavFilterHelper.CreateFilter(Int32 fieldId, FilterType exprType, String exprValue, Boolean valueIsFilter, NavRowEntry fromRowEntry, Boolean clearPrimaryKeyValues) in s:\repo\src\Platform\Client\Shared\Prod.Client.UI\Databinder\Filtering\NavFilterHelper.cs:line 283 at Microsoft.Dynamics.Nav.Client.DataBinder.NavFilterHelper.AddFilter(NavFilterGroup[]& filterGroups, Int32 filterGroupNo, Int32 fieldId, FilterType exprType, String exprValue, Boolean valueIsFilter, NavRowEntry fromRowEntry, StringBuilder filterDescription, Boolean isRunformLinkFilter, Boolean clearPrimaryKeyValues) in s:\repo\src\Platform\Client\Shared\Prod.Client.UI\Databinder\Filtering\NavFilterHelper.cs:line 531 at Microsoft.Dynamics.Nav.Client.DataBinder.NavFilterHelper.AddSubFormLinkFilter(NavFilterGroup[]& filterGroups, IFilterDefinition filterDefinition, NavRowEntry navRowEntry) in s:\repo\src\Platform\Client\Shared\Prod.Client.UI\Databinder\Filtering\NavFilterHelper.cs:line 469 at Microsoft.Dynamics.Nav.Client.Communication.NavBindingManagerConsumerPort.ConstructNewFilter(NavRowEntry providerRowEntry) in s:\repo\src\Platform\Client\Shared\Prod.Client.UI\Communication\NavBindingManagerConsumerPort.cs:line 479 at Microsoft.Dynamics.Nav.Client.Communication.NavBindingManagerConsumerPort.RefreshLinkedPageIfNecessary(IMessage message) in s:\repo\src\Platform\Client\Shared\Prod.Client.UI\Communication\NavBindingManagerConsumerPort.cs:line 199 at Microsoft.Dynamics.Framework.UI.ConsumerPort.MessageAvailable(IMessage message) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Communication\ConsumerPort.cs:line 26 at Microsoft.Dynamics.Framework.UI.CommunicationChannel.SendConsumerMessage(IMessage message) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Communication\CommunicationChannel.cs:line 231 at Microsoft.Dynamics.Framework.UI.CommunicationChannel.PullMessage() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Communication\CommunicationChannel.cs:line 378 at Microsoft.Dynamics.Framework.UI.CommunicationBroker.HandleMessages(IConsumerPort consumerPort) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Communication\CommunicationBroker.cs:line 505 at Microsoft.Dynamics.Framework.UI.BindingManagerConsumerPort.FillStarting() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Communication\BindingManagerConsumerPort.cs:line 55 at System.EventHandler.Invoke(Object sender, EventArgs e) at Microsoft.Dynamics.Framework.UI.BindingManager.ChangeStateToFilling() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Databinding\BindingManager.cs:line 3031 at Microsoft.Dynamics.Framework.UI.BindingManager.DoFill(DataReaderFillOptions fillOptions) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Databinding\BindingManager.cs:line 1980 at Microsoft.Dynamics.Framework.UI.BindingManager.Fill(BindingManagerFillOptions options) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Databinding\BindingManager.cs:line 1899 at Microsoft.Dynamics.Framework.UI.LogicalForm.LoadDataInternal() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Forms\LogicalForm.cs:line 1671 at Microsoft.Dynamics.Framework.UI.LogicalForm.LoadData() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Forms\LogicalForm.cs:line 1629 at Microsoft.Dynamics.Framework.UI.LogicalForm.LoadChildFormsData(Boolean forceDelayLoad) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Forms\LogicalForm.cs:line 1691 at Microsoft.Dynamics.Framework.UI.LogicalOperationInvoker.<>c__DisplayClass31_0.<UISession_FormToShow>b__0() in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Threading\LogicalOperationInvoker\LogicalOperationInvoker.cs:line 545 at Microsoft.Dynamics.Framework.UI.LogicalOperationInvoker.InvokeAndHandleExceptions(Func1 action, IExceptionHandler exceptionHandler) in s:\repo\src\Platform\Client\Shared\Prod.ClientFwk\Threading\LogicalOperationInvoker\LogicalOperationInvoker.cs:line 397 Source: mscorlib

atoader commented 4 years ago

Hi @hougaard ! Could you provide a sample to reproduce the issue? It really helps with fixing this type of issues faster.

hougaard commented 4 years ago

Create a ListPart that is filtered with SystemId in SubPageLink as a part on a page.

acjdekorte commented 4 years ago

We run into the same problem or at least it looks like the same problem. We use a systemid in the subpagelink to link a factbox to approximally 140 pages.

When opening the cardpage directly by lauch.json. The page gives the following error image. When going via the listpage, the cardpage tries to open and after some seconds: image

Please find attached a simplified example of our code Example_error_systemid.al.txt

We are using BC15 CU3

acjdekorte commented 4 years ago

The problem also occurs with the runpagelink.

elweilando commented 4 years ago

The problem also occurs within a query object. TestQueryWithSystemId_1.al.txt TestQueryWithSystemId_2.al.txt

Drakonian commented 4 years ago

Any updates?

acjdekorte commented 4 years ago

@atoader Could you provide any update on this issue?

TeusV commented 4 years ago

@atoader @qutreson @thpeder Any updates, please? Especially since auto increment fields can no longer be used to create surrogate keys, the SystemId provides great value in making it possible to have a stable link to any record with just two fields. Were it not for this issue...

atoader commented 4 years ago

Hi! I've asked our colleagues in the server runtime area and they are aware of the issue. I cannot provide an ETA at the moment. For issues concerning the runtime, the best path forward is to open an issue through collaborate. I will add a link to this issue in the internal tracking item and close it as it is outside of the scope of this repository.

f4n0 commented 4 years ago

I know that it is closed, but I have the same error, Are there any updates?

TeusV commented 4 years ago

@atoader I've got the 'through collaborate' response before, but after several attempts I have not found a place in collaborate to file anything regarding Business Central; only the 'Dynamics NAV Feedback' program/engagement where only Feature Requests (not bugs) up to NAV2018 can be filed, and which appears to be some sandbox environment, since it mostly contains test requests, and where reported bugs are closed without any comment, like https://partner.microsoft.com/en-us/dashboard/collaborate/engagements/3737/feedback/wits/Feature%20Request/173144 (where it is also mentioned 'This is the third portal that i sent this bug report, everybody just redirects this. I dont know where else to send this.'

In other words, could you direct us somewhere which is not a dead end?

atoader commented 4 years ago

You should post issues under https://partner.microsoft.com/en-us/dashboard/collaborate/engagements/1173 . The name of the engagement is Ready! for Dynamics 365 Business Central

GhOnBc commented 4 years ago

This problem is still present in BC16.2 .. any updates?

TeusV commented 4 years ago

https://partner.microsoft.com/en-us/dashboard/collaborate/engagements/1173/feedback/wits/Bugs/332204 Current status here is 'New'...

kevindstanley1988 commented 4 years ago

Problem still present in BC16.3. Any updates?

acjdekorte commented 4 years ago

According to Microsoft, the problem has been fixed. The bug is closed on 24 august. Only no information is currently provided in which version. It could be in CU4, which is publish on 27th of August as fix 363430.

kevindstanley1988 commented 4 years ago

Verified not working with version 16.4 using this project. https://dev.azure.com/wolcottgroupllc/_git/TestSubPageLink

This is a very simple example. I have a table with fields TableID and "Related To System Id". A generic list part with these 2 fields. On the Item card I added the list part with this subpagelink.

SubPageLink = TableId = Const(27), "Related To System Id" = field(SystemId);

We have been waiting for this feature to work since systemId got introduced. It makes table relations far more complex than needed by not allowing for this.