Layers now implement IDisposable.

Nov 10, 2010 at 5:05 AM

This is a breaking change for anyone (looking at you HydroDesktop) that may be creating layers, but persisting the dataset independently from the layer.  If you are taking responsibility for disposing the dataset yourself (that is you may need it even if someone removes the layer from the map) then you can set the PreventDisposeDataSet property to true.  Only do this if you plan need to access the dataset later, and remember to also call Dispose() on the dataset.  This fixes a significant bug where I could open an image once just fine, then remove it, but when I tried to open it again, I can't because the memory was never released.  Now it is releasing just fine.  Most use cases that only created the dataset so that it could be shown as a layer will work without any changes.