When using map.layers.remove the underlying featureset is no longer available.
This is problematic when using IMPLs with another control to add/remove layers.
Comments: ** Comment from web user: danames **
This is problematic when using IMPLs with another control to add/remove layers.
Comments: ** Comment from web user: danames **
Please try this code and let me know if it works for you. - Dan
```
//Create the feature set and lock it
DotSpatial.Data.IFeatureSet fs = DotSpatial.Data.FeatureSet.Open("C:\\Data\\USA\\cities.shp");
fs.LockDispose();
//Add the featureset to the map
DotSpatial.Controls.IMapLayer impl = map1.Layers.Add(fs);
//Remove the layer from the map
map1.Layers.Remove(impl);
//Add it again <----normally this would crash because fs is destroyed, but we locked it.
map1.Layers.Add(fs);
```