Geoprocessing failing due to Definition Query

Discussion created by gracecai on Dec 9, 2013
Latest reply on Dec 13, 2013 by belowzero8

I'm attempting to iterate through the layers in a MXD and generate euclidean distance rasters for them. This works fine when the layers have no definition query applied to them. I get this generic COMException when there is a def query applied. Any thoughts? I've also included a bit of source code.

I've tried calling the gp tool in different ways, so far no luck. I haven't had any luck with searching online either.

Error Msg:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel) at Analust.tool.Dummy(IGeoDataset inFeature) in \\C:\Apps\temp\analyst.cs: line 34

IGeoDataset data = (IGeoDataset)layer;
IGeoDataset EucDistRas = null;
IGeoProcessor gp = new GeoProcessorClass();

IVariantArray parameters = new VarArrayClass();
parameters.Add("1000 Meters");

gp.Execute("EucDistance_sa", parameters, null);

Thank you in advance!