Skip to main content

Notifications

Business Central forum
Answered

Sync-NAVTenant Error when upgrading to BC 16.2

Posted on by 5

Hi Experts,

We have encountered the error below when upgrading the database from BC16.1 to BC 16.2. Previously the database is upgraded from BC15 to BC16.0, then we upgrade from BC16.0 to BC16.1 when released. We upgraded smoothly with no issue. Recently, we tried to upgrade the database to latest BC version(16.2) but hitting the error below when running this command: Sync-NAVTenant -ServerInstance BC161 -Tenant default -Mode Sync -Force

Upgrading the standard database has no issue. But hit the error when upgrading the customer database. 

Any hint for this error is much appreciated. Thank you

Here is the error taken from EventViewer:

Message (ArgumentException): RootException: ArgumentException
An item with the same key has already been added.
ExceptionStackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Dynamics.Nav.Runtime.Apps.CompanionTablePrimaryKeyFixer.GetTablesGroupsWithWrongPrimaryKey()
at Microsoft.Dynamics.Nav.Runtime.Apps.CompanionTablePrimaryKeyFixer.GetCommands()
at Microsoft.Dynamics.Nav.Runtime.NavSqlTenantPropertiesSync.Upgrade(NavSqlConnectionScope conScope)
at Microsoft.Dynamics.Nav.Runtime.NavSqlTenantPropertiesSync.Sync()
at Microsoft.Dynamics.Nav.Runtime.NavSqlDatabaseSync.SynchronizeTenantDatabase(NavSession session, SynchronizationSetup syncSetup, Boolean sortingPropertiesDifferent)

Categories:
  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Thank you for sharing final outcome with the community.

  • Verified answer
    hverheij Profile Picture
    hverheij 55 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hi,

    Thank you for sharing this solution.

    Dropping the $AppData tables made that I could execute Sync-NavTenant succesfully

    Regards, Henry

  • Suggested answer
    BreedX Profile Picture
    BreedX 5 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Microsoft support provided the possible solutions but it does not resolved the error.

    So, we ended up analyzing the tables and debugging.

    Here are the steps we did:

    1. DELETE FROM dbo.$ndo$navappschemasnapshot WHERE [istableextension] = 1 and originalobjectid = <custom object ID range>

    2. Run Sync-NAVTenant. In our case, we still getting the error

    3. Drop all tables with $AppData. Not sure why these tables exists after converted from 15.2 to 16.1. We found these tables exists in some ways but from other databases that we converted it doesn't.

    4. Run Sync-NAVTenant again.

    We solved our issue for these steps.

    Hope this will help

  • hverheij Profile Picture
    hverheij 55 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    I have the same issue when upgrading from 15.2 to 16.3

    So please post the solution if you have it. Thank You

    Kind regards,

    Henry

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hello,

    Please do share final outcome if possible.

    Thanks.

  • BreedX Profile Picture
    BreedX 5 on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Thanks Marco. We are sending the support ticket.

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Sync-NAVTenant Error when upgrading to BC 16.2

    Hello,

    I assume that it is best to raise a support ticket via your CSP.

    Thanks.

Helpful resources

Quick Links

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284,876 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,425 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans