We are working on a reconcile and post add-in for one of our departments. I'm able to successfully complete the task if there are no conflicts or if I specify which version 'wins'. We would like to utilize the integrated ArcMap functionality for conflict display and resolution.

Unfortunately, when trying to display the conflict window, I'm having issues. First of all, the conflict window does not specify that there are any conflict classes even though the IVersionEdit4 object specifies there are and the reconcile result is 'true'. Secondly, if I try to display the conflict window anyway, the window opens and ArcMap crashes--even if I surround the code in a try block.

I'm open to suggestions. I am not particularly interested in manually finding the sources of the conflict when the functionality is there to accomplish the task in ArcMap natively and the code is exposed in ArcObjects to accomplish the task.

Am I missing something? Do I need to somehow assign which class the conflict is to the window?

Here's the code in question:

    bool ReconcileToDefault(Version ToReconcile, out bool? hadConflicts)
        ChangeDataSourceToDefault(ToReconcile); //changes datasources in map document to default version to prevent lock issues
        hadConflicts = null;
        IVersionedWorkspace wkspc = (IVersionedWorkspace)DBConnect.ConnectToDB("sde.DEFAULT", true);
        if (wkspc == null) return false;
        IVersion Reconcile = wkspc.FindVersion(ToReconcile.name);
        //EventListener evtListener = new EventListener(Reconcile);
        IMultiuserWorkspaceEdit muWorkspaceEdit = (IMultiuserWorkspaceEdit)Reconcile;
        IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)Reconcile;
        IVersionEdit4 versionEdit = (IVersionEdit4)muWorkspaceEdit;
        //Open the conflict resolution window. (ArcMap bombs out here, so I'm trying a different way)
        //if (cWin == null)
        //    IEditor editor = (IEditor)ArcMap.Application.FindExtensionByCLSID(new UID() { Value = "esriEditor.Editor" });
        //    cWin = (IConflictsWindow3)editor.FindExtension(new UID() { Value = "esriEditor.ConflictsWindow" });
        //    cWin.Reset();
        //    cWin.Visible = true;
        hadConflicts = versionEdit.Reconcile4("sde.DEFAULT", false, false, false, true); //I set acquire locks to true if I'm actually posting.
        if (hadConflicts == true)
            var cl = ConflictResolutionDialog.CurrentClass; //variable is null with current database state
            IConflictClass first = versionEdit.ConflictClasses.Next(); //variable is a valid IConflictClass with current database state
            //MessageBox.Show(ConflictResolutionDialog.HasConflicts().ToString()); //displays false
            //MessageBox.Show(String.Format("Had {0} Conflicts.",ConflictResolutionDialog.ClassCount)); //conflict count = 0
            //ConflictResolutionDialog.Visible = true; //causes arcmap to crash
        //versionEdit.Post("sde.DEFAULT"); //works just fine
        workspaceEdit.StopEditing(false);//generally set this to true if I post
        return true;

Thanks for your attention,

  • Welcome to our site, Jason! Please feel free to put whatever contact info you want into your profile. It doesn't need to reappear in your post. – whuber Nov 9 '12 at 16:47

I recall that in the public API, the Conflicts Window is tied directly to the ArcMap Editor (internally, you can initialize it with stateids which IMHO is orders of magnitude more useful). In your case, you are circumventing the reconciliation phase so that it is done at the GeoDatabase level instead of the ArcMap Editor Extension level. This causes the conflict window to be out of whack - it is asking the Editor Extension for its workspace and its reconciliation state which have not changed - the version that has changed is the one you connected to outside of the Editor Context.

The solution is to use the methods on the Editor instead. That means that instead of calling StartEditing on the GeoDatabase, call the Editor::StartEditing(workspace) method.

In addition, show the Conflicts Window outside of the edit operation - it doesn't make sense to show conflicts of an "intermediate" state (rows can still be manipulated in that transaction by other listeners).

The ConflictsWindow should work fine then.

  • I'm having major issues to the tune of COM Exceptions when trying to begin an edit session in this manner ({"Exception from HRESULT: 0x8004A003"}). If I'm able to get the edit session to start (which I cannot now reproduce), then when I run the version.Reconcile4() method, I get an error stating that it cannot be reconciled because I'm not in an edit session. Any suggestions on how to implement the IEditor method of reconciliation and avoid these issues? – Jason Roebuck Nov 9 '12 at 20:49
  • Can you post the updated code? As far as I can tell, "-2147180541" is an unlisted HRESULT error code – Ragi Yaser Burhum Nov 9 '12 at 21:59
  • It could be that the workspace you started editing is not a layer in the TOC and it is causing an error. See this example edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriEditor/… – Ragi Yaser Burhum Nov 9 '12 at 22:43
  • Fixed. Will post updated code very soon. @Ragi, your initial answer fixed it mostly. The other issue was subtleties with the database connection (the server name on a direct connection does not matter, so a colleagues code had the name of the db instead of the server, thus causing issues with the start edit routine). – Jason Roebuck Nov 14 '12 at 16:06
  • Cool. By the way, I wrote the Conflicts Window back in 2005/2006 so I am just giving information based on what I remember from 6 years ago and I am not well known for having good memory :-O – Ragi Yaser Burhum Nov 14 '12 at 19:31

It took me longer than desired to leverage the OP along with the answer from @Ragi to get the conflicts window to populate, probably due to my obtuseness. For others in the same boat, here is a code sample that checks for version conflicts in a reconcile, and then displays the conflicts window when conflicts were found.

// get editor reference
ESRI.ArcGIS.esriSystem.UID editorUid = new ESRI.ArcGIS.esriSystem.UID() { Value = "esriEditor.Editor" };
ESRI.ArcGIS.Editor.IEditor editor = (ESRI.ArcGIS.Editor.IEditor)_application.FindExtensionByCLSID(editorUid);

// get reference to current edit workspace
ESRI.ArcGIS.Geodatabase.IWorkspace editWorkspace = editor.EditWorkspace;
ESRI.ArcGIS.Geodatabase.IVersionEdit4 versionEdit = (ESRI.ArcGIS.Geodatabase.IVersionEdit4)editWorkspace;

// get parent version name
string parentVersionName = ((ESRI.ArcGIS.Geodatabase.IVersion)editWorkspace).VersionInfo.Parent.VersionName;
// reconcile to parent, with locks, not aborting on conflict to allow for conflict resolution
bool hadConflicts = versionEdit.Reconcile3(parentVersionName, true, false);
if (hadConflicts)
    // get conflicts window reference
    ESRI.ArcGIS.esriSystem.UID conflictsUid = new ESRI.ArcGIS.esriSystem.UID() { Value = "esriEditor.ConflictsWindow" };
    ESRI.ArcGIS.Editor.IConflictsWindow3 conflictsWindow = (ESRI.ArcGIS.Editor.IConflictsWindow3)editor.FindExtension(conflictsUid);
    // reset appears to load the conflicts into the window
    // show conflicts window
    conflictsWindow.Visible = true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.