AnsweredAssumed Answered

How to release a raster file from locking after deleting it's layer from arcmap using arcobjects

Question asked by shehab100100100 on Oct 6, 2016
Latest reply on Oct 13, 2016 by shehab100100100

I'm creating an addin in which I need to delete the raster file after deleting it's layer from the current map.

The layer is deleted no problem.

ArcMap.Document.FocusMap.DeleteLayer(layerToRemove);

ArcMap.Document.UpdateContents();

ArcMap.Document.ActiveView.Refresh();

Marshal.FinalReleaseComObject(layerToRemove);

 

The issue is this: when I try to delete the source file, it gives me IO exception that is the file is in use with arcmap process.

 

Any help will be appreciated.

Outcomes