AnsweredAssumed Answered

Weird Issue with onDeleteFeature event

Question asked by bulla_b on May 3, 2019
Latest reply on May 13, 2019 by bulla_b



So I've written an Editor Extension which has some code that runs when a feature is deleted.  Everything works 100% as needed, but today I decided to add a few lines of code to track some information in a Share Point List when a feature gets deleted.  As soon as I add that code, none of the code within my onDeleteFeature event fires.  It's like it doesn't even exists. soon as I comment out the code I added, everything works fine.  Really weird.  I don't know what the heck is going on.


See below.  The code below works, but as soon as I uncomment the commented out section, nothing works.  i don't even get the message box to pop up.  If I debug, nothing in this entire code block runs, but the delete still happens in ArcMap.


Any ideas??



        //When a feature is Deleted.
        void Events_OnDeleteFeature(ESRI.ArcGIS.Geodatabase.IObject obj)
                if (obj is IFeature)
                    //Cast to an IFeature
                    IFeature inFeature = (IFeature)obj;                
                    ITable inTable = obj.Table;

                    if (inTable is IVersionedObject)
                        IVersionedObject3 vObject = (IVersionedObject3)inTable;

                        //Check if the Features Table is Versioned.  If not, then exit.
                        if (vObject.IsRegisteredAsVersioned)
                            //Look for the Maximo field and edit.
                            if (inFeature.Fields.FindField("MXCREATIONSTATE") != -1)
                                //using (SPSite spSite = new SPSite("https://...."))
                                //    using (SPWeb spWeb = spSite.OpenWeb())
                                //    {
                                //        spWeb.AllowUnsafeUpdates = true;
                                //        SPList list = spWeb.Lists["GIS_Deletes"];

                                //        //Add an item
                                //        SPListItem newItem = list.Items.Add();
                                //        newItem["MXASSETNUM"] = inFeature.Fields.FindField("MXASSETNUM").ToString();
                                //        newItem["MXSITEID"] = inFeature.Fields.FindField("MXSITEID").ToString();
                                //        newItem.Update();

                                //        spWeb.AllowUnsafeUpdates = false;
                                //    }
            catch (Exception ex)
                MessageBox.Show(ex.ToString(), "Error in OnDeleteFeature procedure.");