laptop and a wrench

Bug

Deleting a topology results in the inability to edit feature classes that had participated in that topology, unless ArcMap is closed and launched again.

Last Published: August 19, 2020 ArcGIS for Desktop
Bug ID Number NIM070232
SubmittedJuly 6, 2011
Last ModifiedJune 5, 2024
Applies toArcGIS for Desktop
Version found10.0
Program languageC#
StatusWill Not Be Addressed

Additional Information

We apologize that we were unable to address this issue within the current product support cycle.  If the issue continues to affect your work in a supported release, please contact Technical Support.

Workaround

//ArcMap.Document is used because this workaround was tested in an Add-In button for Arcmap.IMxDocument pDoc = ArcMap.Document; IMap pMap = pDoc.FocusMap;IDataset pDataset = null;IFeatureLayer pFeaLayer = (IFeatureLayer)pMap.get_Layer(0);string lName = pFeaLayer.Name;IFeatureClass pFeaClass = pFeaLayer.FeatureClass; ITopologyClass pTopoClass = (ITopologyClass)pFeaClass; ITopology pTopo = (ITopology)pTopoClass.Topology;IDataset pFCDataset = (IDataset)pFeaClass;string name = pFCDataset.Name;IWorkspace pWorkspace = pFCDataset.Workspace;IDataset pWsDataset = (IDataset)pWorkspace;IWorkspaceName pWSName = (IWorkspaceName)pWsDataset.FullName;IGxDatabase pGxDatabase = new GxDatabase();pGxDatabase.WorkspaceName = pWSName;IGxObject pObject = (IGxObject)pGxDatabase;pDataset = (IDataset)pTopo;if (pDataset.CanDelete()){ pDataset.Delete(); //At times objects will inherit from a given object and there will be several //instances in memory. We need to dump all of the references to the object //in memory by placing the releaser in a while loop, until all the references are gone //the Releaser will keep going. while (Marshal.ReleaseComObject(pDataset) > 0) { };}pObject.Refresh();while (Marshal.ReleaseComObject(pFeaClass) > 0) { };//disconnect and delete the layer from the mapIDataLayer2 dl = (IDataLayer2)pFeaLayer;dl.Disconnect();pMap.DeleteLayer(pFeaLayer);while (Marshal.ReleaseComObject(pFeaLayer) > 0) { };//the workspace reference does not seem to impact this so we can continue to use this referenceIFeatureWorkspace fw = (IFeatureWorkspace)pWorkspace;IFeatureClass fc = fw.OpenFeatureClass(name);//we got the name of the feature class and layer but they could also look at options to preserve //other aspects of the layers state...symbology, ect. if necessaryIFeatureLayer fl2 = new FeatureLayer(){ FeatureClass = fc, Name = lName, ShowTips = true};//the re-added layer should be editablepMap.AddLayer(fl2);

Steps to Reproduce

Bug ID: NIM070232

Software:

  • ArcGIS for Desktop

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options