microsoft / microsoft/AL

Import-NAVData to a new tenant and/or instance fails when the .navdata file contains an unpublished Designer extension

Open
#6,094 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

This is a new issue to reproduce the bug discussed in closed issue https://github.com/microsoft/AL/issues/4217

Describe the bug
When exporting a .navdata file from a tenant or single tier service instance that contains an unpublished designer extension, the Import-NAVData process will fail when importing the .navdata file to a new tenant/instance if the designer extension is missing in the target.

To Reproduce
In a multi-tenant environment with one tenant ("tenant1"), do the following:

  • Run the in-client designer on tenant1 and add a field to a page. Save the designer extension.
  • uninstall and unpublish the designer extension from tenant1
  • Create a new empty tenant db called "tenant2" and mount it to the same multi-tenant instance. publish/sync/install all the same extensions that are published in tenant1. Note we will not publish the designer extension that was previously created and unpublished in tenant1, since it's "gone" forever for all intents and purposes.
  • Run Export-NAVData on tenant1
  • Run Import-NAVData on tenant2 to import the .navdata file into it. The import will fail with an error similar to this:
Import-NAVData : Cannot import the data because the specified file contains the following extension that has not been synchronized to the database: name=Designer_544cc16c-942a-4869-bcfb-cdd628d2b9f3,
publisher=Designer, version=1.0.0.0.
+       Import-NAVData -ServerInstance $ServerInstance -tenant $TargetT ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (0:Int32) [Import-NAVData], FaultException`1
    + FullyQualifiedErrorId : MicrosoftDynamicsNavServer$BC16-NA-MT-Sandbox/clone-markfulcher-2,Microsoft.Dynamics.Nav.Management.Cmdlets.ImportNavData

Expected behavior

Import-NAVData should not fail on missing extensions in the target database where the missing extensions do not contain any table objects nor tableextension objects (as is the case for designer extensions since they'll only contain pageextension objects). Theres no reason to error out on a missing designer extension if there is no table/tableextension data for it.

Furthermore, since the designer extension is unpublished in tenant1, it is not possible to query these unpublished extentions via the development shell. The only way is to interrogate the following tables via SSMS and remove the designer extensions manually from the following tables:

  • [$ndo$navappuninstalledapp]
  • [$ndo$navappschematracking]

For unpublished extensions in tenant1, Sync-NAVApp -mode clean to purge the unpublished extension from tenant1 before running export-navdata is a legitimate solution for unpublished extensions that contain table and/or tableextension objects, but this should be an unnecessary step for designer extensions.

5. Versions:

  • Business Central:
    Version: NA Business Central 16.2 (Platform 16.0.13440.13772 + Application 16.2.13779.0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction steps for Export-NAVData and Import-NAVData, and review the discussion in closed issue #4217. Use the listed SSMS tables, [$ndo$navappuninstalledapp] and [$ndo$navappschematracking], to understand the unpublished-extension state. Done means importing data succeeds when the missing extension contains no table or tableextension objects, without manual cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.