Shapefile LOCK files

Discussion created by Harpua on Feb 3, 2011
Latest reply on Feb 16, 2011 by agray1

I have a WCF service that opens a collection of shapefiles and uploads the data from these shapefiles into their respective SDE feature classes.  Everything works perfectly except at the very end when I wish to delete the shapefiles as they are stored in a temporary location on the server. The act of opening a featurecursor on the shapefiles creates a LOCK file the same as if you were to view the file in ArcCatalog.  I do everything that I can possibly think of to release the lock on the shapefile, including System.Runtime.Interop.Marshal.ReleaseComObject & FinalReleaseComObject (neither works) on all ArcObjects that I use along with shutting down the ArcObjects license that I check out at the beginning of the whole procedure. I cannot find any hints as to how to release the lock on the shapefile.  It eventually goes away if I wait long enough, but I need for it to go away immediately after I am done looping through the feature cursor.  Does anyone have any ideas on how to release these locks? I tried to use the ESRI.ArcGIS.esriSystem.IAppLockMgr but I cannot find any examples on how to use this and I'm not even sure if it is the correct interface to use for this.

Any help would be GREATLY appreciated.

Thanks in advance,

- Matt