Error running ArcToolbox Tool with Igeoprocessor

Discussion created by ah1508 on Mar 9, 2011
I'm trying to run the ArcToolBox Tool, "Process ArcPad Project", programmatically using IGeoProcessor.  I keep getting ERROR 999998: Unexpected Error.  When I run this tool from the toolbox within the same ArcMap Session using the same inputs, it works just fine. 

      Dim toolboxPath As String
      toolboxPath = "C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\ArcPad Tools.tbx"
      Dim gpParams As ESRI.ArcGIS.esriSystem.IVariantArray
      gpParams = New ESRI.ArcGIS.esriSystem.VarArray

      ' Execute the tool.
      Dim gpResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult
      gpResult = New ESRI.ArcGIS.Geoprocessing.GeoProcessorResult
      gpResult = gp.Execute("ProcessArcPadProject_arcpad", gpParams, Nothing)

Within the results window, the two runs appear exactly the same except that the "Cartographic Coordinate System" and the "Geographic Transformation" lines are missing in the Failed Run.  To fix this I explicitly set the environment variables programmatically to match the successful run.  It still gives me the error, but the "Cartographic Coordinate System" and the "Geographic Transformation" are present.  I was able to run the Buffer_Analysis tool successfully, when it was substituted in this code block.

Does anyone have any ideas as to why this won't run?  It must have something to do with the Geographic Transformation or the Coordinate System, but shouldn't it use the preset environment settings just like the Toolbox Tool?