ThinkGeo.com    |     Documentation    |     Premium Support

Temporary Files Never Get Deleted

Greetings,


I was taking already existing Shapefiles and splitting them into smaller Shapefiles using ShapeFileFeatureLayer.CloneShapeFileStructure(string, string, OverwriteMode), then adding each shape to its new shapefile.  I found that in the process of doing this, one or more temporary files are created using Path.GetTempPath(), however these files are never deleted, so after this function has been called 65535 times (the limit to the number of temporary paths one can create), the application will crash until some temporary files have been deleted.



Ryan, 



Thanks for reporting it's definitely a bug. Just wonder how you split the shapefile, I checked the source code of CloneShapeFileStructure() and found it removes the temp files internally, so maybe when using under some situations it causes that problem. So it will be great if you can let me know how you split the shapefile. 



Thanks, 



Ben 

 



I've included a sample program with this behavior that uses the Austinstreets.shp sample data file provided in your samples.  When you click the test button, the number of temporary files is displayed, then the shapefile is cloned, and then the new number of temporary files is displayed.  Note that the Austinstreets.shp must be copied into the directory for this to run.



391-TempTester.zip (12.7 KB)

Ryan, 
  
 Thank you very much for the sample. We recreated this issue and will fix it in the next release. Thanks for pointing it out. 
  
 Ben.