Select to view content in your preferred language

pEditor.StopEditing(True) CRASHING ARCMAP

459
1
12-20-2011 05:31 PM
matthewandreatta
Deactivated User
Hi all,

Could some PLEASE point out why the code below works for polyline and polygon layers but not point layers.  I have tried it on various different point layers with no luck.
Arcmap just crashes out and gives me the send error log window.  Using arcmap 10 SP3.


  Private Sub myEditorEvents_OnSketchFinished() Handles myEditorEvents.OnSketchFinished

        Dim pMxDoc As IMxDocument
        pMxDoc = My.ArcMap.Application.Document 'ThisDocument

        Dim pEditor As IEditor
        Dim pID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass

        Dim theapp As ESRI.ArcGIS.Framework.IApplication
        theapp = My.ArcMap.Application

        pID.Value = "esriCore.Editor"
        pEditor = theapp.FindExtensionByCLSID(pID)


        pEditor.StartOperation()
        Dim pFeature As IFeature
        Dim pEnumFeat As IEnumFeature
        Dim pUID As New UID
        pUID.Value = "esricore.editor"

        pEditor = My.ArcMap.Application.FindExtensionByCLSID(pID)
        pEnumFeat = pEditor.EditSelection
        pEnumFeat.Reset()
        pFeature = pEnumFeat.Next
        pFeature.Store()
        pEditor.StopEditing(True)
0 Kudos
1 Reply
by Anonymous User
Not applicable
You shouldnt be changing the state of the editor, eg stop editing, in an event that it fires. Many internal components also listen to edit events and expect the editor to be still in an edit session when their event is processed, this is whats causing the crash. You'll have to adjust your workflow.
0 Kudos