Hi Dennis,
I reproduced this exception when I tried to close the application form.
If you also met that when you try to close application, I think that’s because your code hadn’t call close for this layer.
Generally you can close it after use it like this:
map.CurrentExtent = fileGeoDatabaseFeatureLayer.GetBoundingBox();
fileGeoDatabaseFeatureLayer.Close();
map.Refresh();
Regards,
Ethan