Custom layout crashes NAV after upgrade

Currently I’m upgrading a customer from NAV2015 to NAV2017.
During the implementation of NAV2015 the customer has asked me, I they could design there reports themselfs.

And my reflection was, why not.

So as said the customer changed there report layout within NAV with the feature “Custom Layouts”.
A new feature back in NAV2015 but still available in NAV2017.

Now during the upgrade of this customer I ran into some issues when testing the upgraded version.
Every time I try to print a report with a custom layout NAV crashes with no more information.

After troubleshooting the layouts i found the cause of this behavior.
During the upgrade process of code the PowerShell cmdlets upgraded the reports without error.

So as you can see the system added a new field in the dataset of the report. Nothing special.

But in combination with the custom layouts there is a problem.
The custom layout didn’t have the new field in the dataset and that is the reason for crashing NAV.

To fix this I thought to use the upgrade codeunit 104060 “Report Layout Upgrades”. Which is used during the data migration from NAV2015 to NAV2017.
As you can see there is some example code to replace or delete fields.

But the one I need is the add function. And that one is missing.

The only way to fix this issue, is to open every custom layout in NAV, don’t change anything in the report itself and save it in NAV. In the background NAV generate the custom layout with the new dataset.

And from then the new fields are also added to the custom layout and NAV don’t crashes anymore.

I hope Microsoft will fix this in the (near) future, so that we don’t lose much time when upgrading custom layouts.

4 thoughts on “Custom layout crashes NAV after upgrade

  1. Bardur Knudsen says:

    Thank you for describing this problem – we have logged a bug in our system to track the issue.
    Can I ask for a couple of additional information to help us?
    1) Can you take a look in the Event Viewer and see what got logged when the client crashed? Hopefully there is a call stack or some information we can use to track the bug
    2) Just to be sure: They made a change to an RDLC layout right? Not Word?

    1. Punky says:


      1) indeed there is a call stack for this crash in the Event Viewer

      Toepassing: Microsoft.Dynamics.Nav.Client.exe
      Framework-versie: v4.0.30319
      Beschrijving: het proces is beëindigd als gevolg van een onverwerkte uitzondering.
      Uitzonderingsinformatie: System.Xml.XmlException
      bij Microsoft.Dynamics.Framework.UI.LogicalAction.InvokeCoreWithErrorHandling(Microsoft.Dynamics.Framework.UI.LogicalControl, System.Object, Microsoft.Dynamics.Framework.UI.UISession)
      bij Microsoft.Dynamics.Framework.UI.LogicalAction.DoInvoke(Microsoft.Dynamics.Framework.UI.LogicalControl, Microsoft.Dynamics.Framework.UI.UISession)
      bij Microsoft.Dynamics.Framework.UI.ActionControl.Invoke()
      bij Microsoft.Dynamics.Framework.UI.Windows.ActionsHelper.ModalitySafe(System.Action)
      bij Microsoft.Dynamics.Framework.UI.Windows.ActionControlAdapterBase.DefaultInvokeAction(Microsoft.Dynamics.Framework.UI.Windows.LogicalControlAdapter, Microsoft.Dynamics.Framework.UI.ActionControl)
      bij Microsoft.Dynamics.Framework.UI.UX2006.WinForms.LogicalCommand.Execute(System.Object)
      bij System.Windows.Controls.Button.OnClick()
      bij System.Windows.Controls.Ribbon.RibbonButton.OnClick()
      bij System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
      bij System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
      bij System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
      bij System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
      bij System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
      bij System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
      bij System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
      bij System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
      bij System.Windows.Input.InputManager.ProcessStagingArea()
      bij System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
      bij System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
      bij System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
      bij System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
      bij MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
      bij MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
      bij System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
      bij MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
      bij System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
      bij MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
      bij System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
      bij System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
      bij System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
      bij System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
      bij System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
      bij Microsoft.Dynamics.Nav.Client.WinClient.NavWinFormsClientSession.RunMessagePump()
      bij Microsoft.Dynamics.Nav.Client.WinClient.NavWinFormsClientSession.RunCore()
      bij Microsoft.Dynamics.Nav.Client.WinClient.NavClientErrorHandler.ExecuteAndCatchExceptions(System.Func`1)
      bij Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.DoExecute(System.Func`1
      bij Microsoft.Dynamics.Nav.Client.WinClient.StartWinFormsClient.RunCore()
      bij Microsoft.Dynamics.Nav.Client.WinClient.StartWinFormsClient.Run(Boolean)
      bij Microsoft.Dynamics.Nav.Client.Program.Main(System.String[])

      Faulting application name: Microsoft.Dynamics.Nav.Client.exe, version: 10.0.18197.0, time stamp: 0x599f2017
      Faulting module name: KERNELBASE.dll, version: 6.3.9600.17031, time stamp: 0x53089862
      Exception code: 0xe0434352
      Fault offset: 0x00000000000068d8
      Faulting process id: 0x144
      Faulting application start time: 0x01d332146fde05b7
      Faulting application path: C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe
      Faulting module path: C:\Windows\system32\KERNELBASE.dll
      Report Id: f412d786-9e08-11e7-80bb-005056b49f4a
      Faulting package full name:
      Faulting package-relative application ID:

      2) In is only with RDLC reports.

      Nice to see that it is reported within Microsoft.
      Thanks for reading my blog.


        1. Niels-Henrik Sejthen says:

          The Add method is not needed in the upgrade code for layouts, as the runtime will handle the added fields automatically based on report metadata. The upgrade functions adds the features that cannot be handled automatically from metadata differences and should be seen as an extension of the automated upgrade.


Leave a Reply

Your email address will not be published. Required fields are marked *