Hello
I am using GdalRasterLayer to display an .nsf file ("MyFile.nsf"),
When I close the map and then tryto delete the file ("MyFile.nsf"), I get an exception that the file is been hold by another process.
This makes my think that the dispose of the GdalRasterLayer within the map object is not working good.
(I check the same scenario with GdiPlusRasterLayer and a .gif file. In this case there was not problem. after the map had been closed the .gif file was not loked any more)
I tried to call GC.Collect() but it did not helped
I tried to close the map and all its layers manually as following , but it did not worked
foreach (Overlay o in _map.Overlays)
{
if(o is LayerOverlay)
foreach (Layer l in (o as LayerOverlay).Layers)
{
l.Close();
var finalizeMethod = l.GetType().GetMethod("Finalize", BindingFlags.Instance | BindingFlags.NonPublic);
finalizeMethod.Invoke(l, null);
}
o.Close();
}
_map.Dispose();
I found an old thread with similar question, but the answer there is not quite complete
thinkgeo.com/forums/MapSuite/tabid/143/aft/9600/Default.aspx
Can you please explain, how can I make sure that the file been used to create GdalRasterLayer is not been held after the map object is disposed.
Best Regards
Miri