IRasterDataset rasterDS = this.openRasterDataset(); IDataset dataset = rasterDS as IDataset; if (dataset != null) { if (!dataset.CanDelete()) { return false;//can't be deleted } dataset.Delete();
Frank,
I have submitted the below bug report since the issue did not exist in ArcGIS 9.3/9.3.1 thus I have determined the pathname length issue is not by design but rather a bug. Please consider using less lengthy paths. As this issue still needs to be evaluated by our development team, I cannot provide a known length that you can count on.
In the meantime, please consider staying within the 106 folderName length you have observed, but also within a total of approximately 114 characters, which includes the dataset name itself (106 folderName + \ + 8 datasetName = 115). The known limit for a GRIDs dataset name is 13 characters, thus, if you go up to 13 characters for the dataset name, account for this in the folderName such that the total folderName and datasetName is approximately 115:
LINK:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t0000000w000000
Frank, I will now close this support incident. Please use the bug report number to track the progress of the bug from this point forward, as well as to escalate the bug report if you would like to do so. The best place to get this information is from the "My Support Portal", available through a link on the Support Services website at:
http://support.esri.com
or you can go directly to the "Esri Customer Care Portal" here:
http://Customers.esri.com
Bug Report Information
----------------------
Bug Report Number: NIM071209
Synopsis:
In ArcGIS 10, deleting an Esri GRID in ArcCatalog or with IDataset.Delete() will either produce an error or will crash the application when directory path is beyond a certain length.
Long description:
In an ArcGIS Engine 10 console application, deleting an Esri GRID raster file with IDataset.Delete() will either result in a thrown exception at IDataset.Delete() or the console application will crash after IDataset.Delete() is called. It has been observed that this occurs beyond a given length of the directory path or file name path where the GRID is stored on disk. The same is produced in ArcCatalog or with ArcMap's Catalog window, where either an error or application crash occurs when attempting to manually delete within Catalog.
Note 1:
Testing in ArcGIS 9.3.1 SP2 with the same GRID raster and same length in directory/file path does not produce the issue, only in version 10 of ArcGIS. Although a crash in ArcGIS 10 may also be seen when attempting to add or paste a GRID to the same folder location where the Delete causes a crash or exception, customers may be working with GRIDs that were already located in that location prior to version 10 so now they have to modify the location of these files and their source code.
Note 2:
Testing in ArcGIS 10 with a .tif (TIFF) instead of a GRID does not produce the issues.
STEPS TO REPRODUCE:
1. Open EngineConsole950753.sln (ArcGIS Engine 10 console application)
2. Prepare to copy the attached GRID file, compati1, to the three different directory locations that will be tested in the subsequent steps. Please create those directories in Windows Explorer as needed.
3. Test/Start debugging the first directory path location with folderName length of 137:
"C:\Projects\usfws\EasternShore\Vista_EasternShore\GIS_Datasets\Scenarios\Current_Landuse_Baseline\Evaluations\Baseline_Ecological_Systems"
= console application will crash after calling IDataset.Delete() method. Attempting to manually delete the same in ArcCatalog or ArcMap's Catalog window will cause ArcCatalog or ArcMap to crash, as well.
4. Test/Start debugging the first directory path location with folderName length of 109:
"C:\Projects\usfws\EasternShore\Vista_EasternShore\GIS_Datasets\Scenarios\Current_Landuse_Baseline\Evaluations"
= IDataset.Delete() will throw the following Exception:
"Exception from HRESULT: 0x8004101B"
Attempting to manually delete the same in ArcCatalog or ArcMap's Catalog window will cause ArcCatalog or ArcMap to display an error message box with the following message:
"Failed to delete selected object(s)"
5. Test/Start debugging the first directory path location with folderName length of 97:
"C:\Projects\usfws\EasternShore\Vista_EasternShore\GIS_Datasets\Scenarios\Current_Landuse_Baseline"
= IDataset.Delete() method successfully deletes the GRID file. Also, deleting the same GRID file in ArcCatalog or ArcMap's Catalog view does not produce any issues.
---
Regards,
Edgar B.