AnsweredAssumed Answered

Weird Errors popping up on a stable ArcObject extension

Question asked by tkowal on Mar 4, 2015
Latest reply on Mar 17, 2015 by Hornbydd

A custom extension, that has existed many years, stable,.. all of a sudden started get weird errors.  Basically this extension takes a point snaps it to a corresponding LRS and retrieves an Offset, Measure, Side, and a segment ID from the Centerline.  The last time this extension was re-compiled was around ArcGIS 10.0.   I am currently running ArcGIS 10.2.2, the extension was performing fine .... the last successful run was month ago (Not something we run all the time).  No changes have been made to ArcGIS system.  The Window 7 system has only undergone bi weekly updates send out by microsoft. When I run the extension, I get two pop ups:

 

  1. "Item not found in this Collection"
  2. after clearing the above pop-up... "Objects in this Class cannot be updated outside an edit session"

 

The temporary work around is now run the extension after manually setting up an edit session ....  No edit session was ever required previously, last 7-8 years of use!

 

The exception is triggered on the pFeat.Store() execution.  "results" is a simple Collection .  The result collections contains all the correct information...pFeat is defined as an IFeature.

 

I suspect it has something to do with the Window system....Has anyone else experienced this? Any fixes?

 

'Return a cursor for all the features
      pCur = pFlayer.Search(Nothing, False)
      pFeat = pCur.NextFeature
      Do Until pFeat Is Nothing
         System.Windows.Forms.Application.DoEvents()
         Route = pFeat.Value(pFeat.Fields.FindField(fPointRouteName))
         'Get point to pass
         mypoint = pFeat.Shape
         Dim results As New Collection
         GC.Collect()
         System.Windows.Forms.Application.DoEvents()
         My.ArcMap.Application.StatusBar.StepProgressBar()
         results = getms(Route, mypoint)
         Try
         'Update fields
         If results.Item("SegID") = -9999 Then
            results.Remove("ErrDesc")
            results.Add("No Centerline SegID Found", "ErrDesc")
         End If
            pFeat.Value(pFeat.Fields.FindField("MP")) = results.Item("MS")
            pFeat.Value(pFeat.Fields.FindField("Offset")) = results.Item("OFFSET")
            pFeat.Value(pFeat.Fields.FindField("rSide")) = results.Item("rSide")
            pFeat.Value(pFeat.Fields.FindField("ErrDesc")) = results.Item("ErrDesc")
            pFeat.Value(pFeat.Fields.FindField("SegID")) = results.Item("SegID")
            pFeat.Store()
         Catch exp As Exception
            MsgBox(exp.Message)
         End Try
            pFeat = pCur.NextFeature
      Loop

Outcomes