Search code examples
version-controlmicrosoft-dynamicsmorph-xdynamics-ax-2012-r3

What do I do when MorphX won't let me check in?


When I go to check something into MorphX VCS right now, I get the following message:

Cannot create a record in SysVersionControlMorphXRevisionTable (SysVersionControlMorphXRevisionTable). The record already exists.

With things that have already been checked out once, I've been able to resolve this with a get latest and then a new checkout/check in. However, when it comes to doing an Add, I'm completely stuck. Is there a resolution to this or have we completely borked our VCS?

Note: this error is only given when we try to check in from a development project. Checking in directly on the AOT does not give this issue.


Solution

  • Just look at the table SysVersionControlMorphXRevisionTable (in SQL if you can't access) and see what the duplicate record could be. The unique index is ItemPath and Version. I doubt you'll see anything here though.

    It's most likely an issue with the call in this method \Data Dictionary\Tables\SysVersionControlMorphXRevisionTable\Methods\latestVersionNumber where it's trying to get the current highest revision and is being called by \Data Dictionary\Tables\SysVersionControlMorphXRevisionTable\Methods\create.

    Put a breakpoint in the create method line #48 and see what revision.Version is, and before the insert, check in SQL if the ItemPath/Version already exists in SQL.

    I'd guess it's probably a server/client-caching issue. To resolve, refresh all of your client caches under Tools>Caches. If this doesn't resolve, and it's a good idea to do anyway, copy these menu items:

    • \Menu Items\Action\SysFlushAOD
    • \Menu Items\Action\SysFlushData
    • \Menu Items\Action\SysFlushDictionary
    • \Menu Items\Action\SysFlushReportServer

    To a new menu item and change the property RunOn = Server. Then run these and it'll flush your server caches. If this still doesn't work, try restarting the AOS.

    If this doesn't work, your users application user cache files might be corrupt. Close your client and delete the *.auc and *.kti files in %LocalAppData% folder (Typically C:\Users\[user]\AppData\Local) and reopen your client.

    In the environment you are using, have you restored a copy of another database somewhat recently?

    Edit: Now knowing that you did a DB restore, there is a good chance your GLOBALGUID was reused and/or is causing caching issues. See here for more info about how/why this happens.

    You should probably stop your AOS and run these SQL commands:

    UPDATE SYSSQMSETTINGS SET GLOBALGUID = '00000000-0000-0000-0000-000000000000'
    DELETE FROM SYSCLIENTSESSIONS
    DELETE FROM SYSSERVERSESSIONS
    

    Are/were you also having issues with batches running? (Somewhat related, but I'm mainly just curious on this question)