claiborn

Reconcile exe not working on Windows 7 PC

Discussion created by claiborn on Jul 29, 2010
Our GIS group (consisting of a manager, analyst and technician) has a VB.NET *.exe that connects to our SDE, gets all the current Versions, reconciles them to the sde.Default version, then writes some simple text to a *.txt file.

This *.exe has worked since we were in 9.1 and still works on 9.3.1 (with the 9.3.1 License Initialize addition), however, our manager recently had her PC upgraded to run Window�??s 7 OS. She has all the proper .NET framework installed and has no other issues with our other applications (VB.NET *.dll�??s, VBA, models and Python scripts).

We have tried using the �??run as admin�?� option but that does not work.

The error message she gets is:
Description:
Stopped working
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: reconcile.exe
Problem Signature 02: 1.0.3505.12428
Problem Signature 03: 4a7ac60c
Problem Signature 04: Reconcile
Problem Signature 05: 1.0.3505.12428
Problem Signature 06: 4a7ac60c
Problem Signature 07: 1c
Problem Signature 08: 2
Problem Signature 09: PSZQOADHX1U5ZAHBHOHGHLDGIY4QIXHX
OS Version: 6.1.7600.2.0.0.256.48
Locale ID: 1033

I have researched the Event name an only come up with one similar issue.  The resolution was simply to rebuild the project with the most current Visual Studio (2008 in our case) and compile.  We did this but it did not work.  We have considered loading VS2008 on to the manager�??s machine and rebuilding the exe but were interested if there are any other possible settings or code issues that are causing the misfire.

I have also included the main logic of the exe attached as a zipped  *.vb and bleow.

Any help or insight is appreciated.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Imports ESRI.ArcGIS.ArcMapUI
Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.Catalog
Imports ESRI.ArcGIS.CatalogUI
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.DataSourcesGDB
Imports System.IO

Public Class Form1
    Inherits System.Windows.Forms.Form

<Windows Form Designer generated code>

Public Sub GetVersions()
        Dim pSDEWorkspace As IWorkspace
        Dim pVersionedWorkspace As IVersionedWorkspace
        Dim pConnectionProperties As IPropertySet
        Dim pWorkspaceFactory As IWorkspaceFactory
        Dim pVersionInfo As IVersionInfo
        Dim pEnumVersionInfo As IEnumVersionInfo

        'Open a textfile to write any error that occur during reconciliation
        Dim FileName As String
        FileName = "Z:\Admin\ReconcileLog.txt"
        Dim fs As New System.IO.FileStream(FileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.None)
        Dim sw As New System.IO.StreamWriter(fs)
        sw.BaseStream.Seek(0, System.IO.SeekOrigin.End)
        sw.WriteLine(Now)

        'Connect to SDE
        pConnectionProperties = New PropertySet
        With pConnectionProperties
            .SetProperty("Server", "gis2")
            .SetProperty("Instance", "5151")
            .SetProperty("User", "gisadmin")
            .SetProperty("Password", "vector^5")
            .SetProperty("Version", "sde.DEFAULT")
        End With
        pWorkspaceFactory = New SdeWorkspaceFactory
        pSDEWorkspace = pWorkspaceFactory.Open(pConnectionProperties, 0)

        'Get versions
        pVersionedWorkspace = pSDEWorkspace
        pVersionInfo = pVersionedWorkspace.DefaultVersion.VersionInfo
        pEnumVersionInfo = pVersionInfo.Children
        pVersionInfo = pEnumVersionInfo.Next

        Do Until pVersionInfo Is Nothing
            'If pVersionInfo.VersionName = "PETERSS.peterss" Then
            ReconcileIt(pVersionInfo, pVersionedWorkspace, sw)
            'End If
            pVersionInfo = pEnumVersionInfo.Next
        Loop
        sw.WriteLine("Reconcile Process Finished:  " & Now)
        sw.WriteLine(vbNewLine)
        sw.Flush()
        sw.Close()
        fs.Close()

        'Clean up
        pSDEWorkspace = Nothing
        pVersionedWorkspace = Nothing
        pConnectionProperties = Nothing
        pWorkspaceFactory = Nothing
        pVersionInfo = Nothing
        pEnumVersionInfo = Nothing
        FileName = Nothing
        sw = Nothing
        fs = Nothing
        Close()
    End Sub
    Private Sub ReconcileIt(ByVal pVersionInfo As IVersionInfo, ByVal pVersionedWorkspace As IVersionedWorkspace, ByVal sw As System.IO.StreamWriter)
        Dim pVersionEdit As IVersionEdit
        Dim pVersion As IVersion

        pVersionEdit = pVersionedWorkspace.FindVersion(pVersionInfo.VersionName)
        pVersion = pVersionEdit

        'Check to see if version is locked
        If IsLocked(pVersionEdit, sw) Then
            sw.WriteLine(pVersion.VersionName & " can not be reconciled because it is in use by another user.")
        Else
            'Reconcile the version to sde.DEFAULT
            StartEditing(pVersionEdit)
            On Error GoTo AbortOperation
            pVersionEdit.Reconcile("sde.DEFAULT")
            StopEditing(pVersionEdit, True)
            sw.WriteLine(pVersion.VersionName & " has been reconciled.")
        End If

        'Clean up
        pVersionEdit = Nothing
        pVersion = Nothing

        Exit Sub

AbortOperation:
        StopEditing(pVersionEdit, False)
        sw.WriteLine("Error in ReoncileIt: " & Err.Description)
    End Sub
    Private Function IsLocked(ByVal pVersion As IVersion, ByVal sw As System.IO.StreamWriter) As Boolean
        'Helper Function to determine if versioned is locked by another user
        On Error GoTo ErrorHandler
        Dim pEnumLockInfo As IEnumLockInfo
        Dim pLockInfo As ILockInfo

        pEnumLockInfo = pVersion.VersionLocks
        pLockInfo = pEnumLockInfo.Next
        Do Until pLockInfo Is Nothing
            sw.WriteLine(pVersion.VersionName & " is in use by " & pLockInfo.UserName)
            pLockInfo = pEnumLockInfo.Next
            IsLocked = True
        Loop
        'Clean up
        pEnumLockInfo = Nothing
        pLockInfo = Nothing
        Exit Function

ErrorHandler:
        IsLocked = True
        sw.WriteLine("IsLocked: " & Err.Description)
    End Function
    Private Sub StartEditing(ByVal pWorkspaceEdit As IWorkspaceEdit)
        'Helper Function to start editing
        pWorkspaceEdit.StartEditing(False)
        pWorkspaceEdit.StartEditOperation()
    End Sub
    Private Sub StopEditing(ByVal pWorkspaceEdit As IWorkspaceEdit, ByVal bSave As Boolean)
        'Helper Funciton to stop editing
        If bSave Then
            pWorkspaceEdit.StopEditOperation()
            pWorkspaceEdit.StopEditing(True)
        Else
            pWorkspaceEdit.AbortEditOperation()
            pWorkspaceEdit.StopEditing(False)
        End If
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GetVersions()
    End Sub
End Class

Attachments

Outcomes