deleted-user-VeC5jUIlNXtq

AppROT code worked for 10.1 SP1, but no longer works in 10.4.1

Discussion created by deleted-user-VeC5jUIlNXtq on Oct 17, 2016
Latest reply on Apr 24, 2017 by ljacedo

Hi,

 

I have a program that checks a raster catalog against view extent, copies any files to the project folder, and then the final step is to either:

1. Navigate to the project folder where the raster files are saved, if ArcCatalog is open.

or

2. Open ArcCatalog, then perform step 1.

 

This worked perfectly fine in ArcGIS 10.1, but after having upgraded to 10.4.1, this no longer works.

 

I'm using .NET, the code is below. I'm curious why this no longer works (serious application error crash).

' Application Running Object Table to access applications.
Dim pAppROT As IAppROT
pAppROT = New AppROT
' Cycle until ArcCatalog is found.
Dim pGxApplication As IGxApplication
Dim bCatalog As Boolean
Dim iAppCount As Integer
pGxApplication = Nothing
' Get the total number of ESRI "Arc" processes running.
iAppCount = pAppROT.Count

If iAppCount > 0 Then
   Dim i As Integer
   For i = 0 To iAppCount - 1
       If pAppROT.Item(i).Name <> "ArcCatalog" Then
          bCatalog = False
       Else
          bCatalog = True
          Exit For
       End If
    Next i
   ' If catalog doesn't exist, launch one. Go to destination folder.
    If Not bCatalog Then
       Dim iCount As Integer
       iCount = 1
       Shell("C:\Program Files (x86)\ArcGIS\Desktop10.4\bin\ArcCatalog.exe", AppWinStyle.NormalFocus)
       Do While pAppROT.Count = iAppCount
          Thread.Sleep(500)
       Loop
     
      For i = 0 To pAppROT.Count - 1
          If pAppROT.Item(i).Name = "ArcCatalog" Then
             pGxApplication = pAppROT.Item(i)
             With pGxApplication
                .Location = sImageryDestination
               .Refresh(sImageryDestination)
             End With
          End If
       Next i
   Else
       pGxApplication = pAppROT.Item(i)
       With pGxApplication
          .Refresh("Y:\01_GISProject")
          .Location = sImageryDestination
          .Refresh(sImageryDestination)
       End With
   End If
End If

Outcomes