PAGE.RUN Crash

I have just been battling a strange error. When I called a certain page in our solution all clients just crashed, hard.

So what was different with this page? It’s card page,  connected to a list page, works great when users double click on a record in the list page the card opens – Works perfectly.

But if I open the card page directly with PAGE.RUN(xxx,SomeRec) all clients crash!

In the stack trace, I could see something about subforms (DoBuildSubform) so I suspected the culprint was a pagepart (Yeah, Microsoft still calls it “forms” in their code) and I removed my subforms. Sure enough, now everything worked. I inserted each pagepart until I found the offending page.

The sub page uses the BusinessChart control, and it was the only control on that page. Running the sub page didn’t reviel anything strange, so I was puzzled for awhile …

Poking around, I suddenly notices that the PageType was a ListPart, with only one control on the page. There was really no listable thing to do, so I tried to change it into a CardPart instead – and sure enough, now everything worked 🙂

TL;DR Putting a control add-in on a ListPart subpage can crash all clients when the parent page is called with PAGE.RUN or PAGE.RUNMODAL – Change to CardPart to fix crash.

Type: System.ArgumentOutOfRangeException
Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
StackTrace:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Microsoft.Dynamics.Nav.Client.FormBuilder.ActionBuilder.CreateOpenAndCreateAction(LogicalForm parentForm, ActionDefinition actionDef, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\ActionBuilder.cs:line 998
   at Microsoft.Dynamics.Nav.Client.FormBuilder.ActionBuilder.CreateMenuAction(ActionDefinition actionDef, LogicalControl parent, UIBuilderContext context, String& imageName) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\ActionBuilder.cs:line 377
   at Microsoft.Dynamics.Nav.Client.FormBuilder.ActionBuilder.CreateAction(ActionDefinition actionDef, LogicalControl parent, UIBuilderContext context, String& imageName) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\ActionBuilder.cs:line 115
   at Microsoft.Dynamics.Nav.Client.FormBuilder.ActionBuilder.DoBuild(ActionDefinition definition, LogicalControl parent, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\ActionBuilder.cs:line 1273
   at Microsoft.Dynamics.Nav.Client.FormBuilder.CommandBarBuilder.CreateActions(CommandBarDefinition definition, UIBuilderContext context, LogicalControl logicalControl) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\CommandBarBuilder.cs:line 247
   at Microsoft.Dynamics.Nav.Client.FormBuilder.CommandBarBuilder.DoBuild(CommandBarDefinition definition, LogicalControl parent, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\CommandBarBuilder.cs:line 72
   at Microsoft.Dynamics.Nav.Client.FormBuilder.UIPartBuilder.DoBuild(MasterPage definition, BindingManager bindingManager, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\UIPartBuilder.cs:line 162
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageBuilder.Build(MasterPage definition, BindingManager bindingManager, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Framework\PageBuilder.cs:line 117
   at Microsoft.Dynamics.Nav.Client.FormBuilder.InfopartBuilderBase`1.CreatePart(TDefinition definition, FormHostControl infopart, UIBuilderContext partContext, Boolean filteringAllowed) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\InfopartBuilderBase.cs:line 103
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageInfopartBuilder.CreatePagePart(InfopartPageDefinition infoPartDefinition, FormHostControl infopart, UIBuilderContext partContext, Boolean filteringAllowed) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\PageInfopartBuilder.cs:line 236
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageInfopartBuilder.DoBuildPagePartCommon(InfopartPageDefinition definition, LogicalControl parent, UIBuilderContext context, BuildingUIPart type, Boolean filteringAllowed) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\PageInfopartBuilder.cs:line 169
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageInfopartBuilder.DoBuildSubForm(InfopartPageDefinition definition, LogicalControl parent, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\PageInfopartBuilder.cs:line 121
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PlaceholderBuilder.BuildChildControls(ControlContainerPlaceHolder definition, LogicalControl parent, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\PlaceHolderBuilder.cs:line 58
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PlaceholderBuilder.DoBuild(ControlContainerPlaceHolder definition, LogicalControl parent, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\PlaceHolderBuilder.cs:line 44
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageBuilder.BuildContent(ContentAreaDefinition contentArea, LogicalForm form, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Framework\PageBuilder.cs:line 1184
   at Microsoft.Dynamics.Nav.Client.FormBuilder.CardPageBuilder.DoBuild(MasterPage definition, BindingManager bindingManager, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Builders\CardPageBuilder.cs:line 49
   at Microsoft.Dynamics.Nav.Client.FormBuilder.PageBuilder.Build(MasterPage definition, BindingManager bindingManager, UIBuilderContext context) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\Framework\PageBuilder.cs:line 117
   at Microsoft.Dynamics.Nav.Client.FormBuilder.BuilderSession.CreateLogicalForm(MasterPage metadata, FormState formState) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.Builder\BuilderSession\BuilderSession.cs:line 328
   at Microsoft.Dynamics.Nav.Client.PageRunCallbackHandler.RunPage(FormRunRequest formRequest) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\PageRunCallbackHandler.cs:line 136
   at Microsoft.Dynamics.Nav.Client.ServiceConnection.ProcessServerResponse(Object response) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.ServiceConnection\ServiceConnection.cs:line 2082
   at Microsoft.Dynamics.Nav.Client.ServiceConnection.CallServer[T](BeginCallServerMethod beginCallServerMethod, EndCallServerMethod`1 endCallServerMethod) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.ServiceConnection\ServiceConnection.cs:line 2029
   at Microsoft.Dynamics.Nav.Client.ServiceConnectionBase.ValidateField(NavRecordState& state, NavDataSet recDataSet, Int32 controlId) in S:\Depot\NAV110\Platform\ClientServerShared\Prod.Types\ServiceConnection\ServiceConnectionBase.cs:line 421
   at Microsoft.Dynamics.Nav.Client.DataBinder.NstDataAccess.ValidateField(ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Databinder\NSTDataAccess.cs:line 602
   at Microsoft.Dynamics.Nav.Client.DataBinder.NavBindingManager.ValidateField(ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Databinder\NavBindingManager.cs:line 1541
   at Microsoft.Dynamics.Nav.Client.Validation.RowEntryValidateItem.ValidateItem(ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Validation\RowEntryValidateItem.cs:line 44
   at Microsoft.Dynamics.Nav.Client.Validation.ValidationHelper.ExecuteValidation(ValidationItem validationItem, String message) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Validation\ValidationHelper.cs:line 434
   at Microsoft.Dynamics.Nav.Client.Validation.ValidationHelper.ValidateItem(ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Validation\ValidationHelper.cs:line 406
   at Microsoft.Dynamics.Nav.Client.Validation.ValidationHelper.Validate(IValidationCaller validationCaller, ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Validation\ValidationHelper.cs:line 233
   at Microsoft.Dynamics.Nav.Client.DataBinder.NavBindingManager.Validate(IValidationCaller validationCaller, ValidationItem validationItem) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Databinder\NavBindingManager.cs:line 1479
   at Microsoft.Dynamics.Nav.Client.Validation.FieldValidationRule.<ValidateValue>d__4.MoveNext() in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.UI\Validation\FieldValidationRule.cs:line 66
   at Microsoft.Dynamics.Framework.UI.ValidationRule.ValidateRuleCollection(ValidationResult result, IEnumerable`1 rules, Object value, IValidationCaller validationCaller) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Validation\ValidationRule.cs:line 89
   at Microsoft.Dynamics.Framework.UI.EditLogicalControl.ValidateHost(IValidationCaller validationCaller, ValidationResult validationResult) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Forms\EditLogicalControl.cs:line 783
   at Microsoft.Dynamics.Framework.UI.ValidationHolder.ValidateInternal(IValidationCaller validationCaller, ValidationResult validationResult) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Validation\ValidationHolder.cs:line 159
   at Microsoft.Dynamics.Framework.UI.ValidationHolder.PerformValidation(IValidationCaller validationCaller, ValidationResult validationResult) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Validation\ValidationHolder.cs:line 136
   at Microsoft.Dynamics.Framework.UI.ValidationHolder.Validate(ValidationResult validationResult) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Validation\ValidationHolder.cs:line 120
   at Microsoft.Dynamics.Framework.UI.EditLogicalControl.SetObjectValue(Object value) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Forms\EditLogicalControl.cs:line 436
   at Microsoft.Dynamics.Framework.UI.StringControl.TrySettingStringValue(String value) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Forms\StringControl.cs:line 186
   at Microsoft.Dynamics.Framework.UI.SaveValueInteraction.InvokeCore(SaveValueInteractionInput logicalInteractionInput) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Interactions\LogicalInteractions\SaveValueInteraction.cs:line 132
   at Microsoft.Dynamics.Framework.UI.InteractionInvoker.Invoke[T](String interactionName, Action`1 invokeMethod, T input) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Interactions\InteractionInvoker.cs:line 42
   at Microsoft.Dynamics.Framework.UI.LogicalInteraction`1.Invoke(T logicalInteractionInput) in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Interactions\LogicalInteraction.cs:line 40
   at Microsoft.Dynamics.Framework.UI.InteractionManager.<>c__DisplayClass8_0.<InvokeInteractions>b__3() in S:\Depot\NAV110\Platform\Client\Shared\Prod.ClientFwk\Interactions\InteractionManager.cs:line 125
Source: mscorlib

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.