UPDATE: upon further investigation, the geoprocessor is not executing, with ERROR 999999:Error executing function; GP3.GetMessage(3) only says that "An error occurred during the buffer operation". This time around, the crash happens later when I try to access the file that was supposedly created. Back to the original question - any ideas on why the geoprocessor wouldn't work with the code below?
Hi all,
I'm using VB.NET (2008) to create a DLL for ArcGIS 9.3.1. I am having difficulty with the geoprocessor. In short, it appears to fail randomly after working normally; but once it fails, I can't get it to work again in subsequent executions. This is happening while I execute within the debugger.
In long...my first attempt to solve this was to switch from using the ESRI.ArcGIS.Geoprocessing.GeoProcessor to using the ESRI.ArcGIS.Geoprocessor.Geoprocessor. This appeared to work, but then after about 15 or so successful executions it stopped working again, again crashing at the geoprocessor, and now I can't get it to work anymore.
Both versions of the geoprocessor give the same result - they'll usually work when I just execute the code within ArcGIS (not using the debugger), but when I attempt to run the code through the debugger, execution fails at the geoprocessor with a hideous and uninformative ArcGIS error ("ArcGIS has encountered a serious application error and is unable to continue"). I've tried validating the geoprocessor inputs (previously, when using the IGeoProcessor interface) before I execute the geoprocessor and the validation comes back fine. The most confusing part about this is that it will work fine for a few debugging sessions, but then all of a sudden, with the same inputs, will start failing. Obviously I'm tweaking parts of the code as I go, but nothing even remotely related to the geoprocessor or its inputs (I know, that's the obvious reason) so I don't know what's going on.
I've pasted the relevant parts of my most current code (with the Geoprocessor.Geoprocessor) below (note that the inputs for parmBuffer are actually concatenations of various strings that evaluate to what I've entered - I've verified in the debugger that they're getting passed as shown) (also, I've verified that the input shapefile exists in that directory). Has anyone else encountered this/does anyone have a suggestion about how to fix it? I'm trying to debug later sections of my code, so not worrying about it because it works fine when executing outside the debugger isn't a viable option.
Thanks!
Dim strTbxPath As String 'path to analysis toolbox
strTbxPath = "C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Analysis Tools.tbx"
Dim GP3 As ESRI.ArcGIS.Geoprocessor.Geoprocessor
GP3 = New ESRI.ArcGIS.Geoprocessor.Geoprocessor()
GP3.AddOutputsToMap = False
GP3.AddToolbox(strTbxPath)
Dim parmBuffer As New ESRI.ArcGIS.AnalysisTools.Buffer
With parmBuffer
[INDENT] .in_features = "C:\GISFiles\TestFiles\RaccoonBufFeatures1.shp"
.out_feature_class = "C:\GISFiles\TestFiles\RaccoonBuffered1.shp"
.buffer_distance_or_field = "10 Meter"
.line_side = "FULL"
.line_end_type = "ROUND"
.dissolve_option = "ALL"[/INDENT]
End With
Try
[INDENT]GP3.Execute(parmBuffer, Nothing) [/INDENT]
Catch err As Exception
[INDENT]MsgBox(err.Message)[/INDENT]
End Try