<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unspecified error when running the Buffer tool. in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401019#M10701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should add some code to see what the messages in your results variable contain. Here's how I have it in one of my applications.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim ErrorMessage As String

Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status &amp;lt;&amp;gt; ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Result.MessageCount &amp;gt; 0 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Count As Integer = 0 To Result.MessageCount - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorMessage += Result.GetMessage(Count)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ErrorMessage, "Geoprocessor failed")
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
End If
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:17:39 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-12-11T18:17:39Z</dc:date>
    <item>
      <title>Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401016#M10698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm getting the following exception thrown when trying to run a Geoprocessing tool:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;"Error HRESULT E_FAIL has been returned from a call to a COM component." &amp;nbsp;&amp;nbsp; at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel) &amp;nbsp;&amp;nbsp; at ESRI.ArcGIS.Geoprocessor.Geoprocessor.ExecuteInner(IGPProcess process, ITrackCancel trackCancel, IGeoProcessor igp, IVariantArray iva) &amp;nbsp;&amp;nbsp; at ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(IGPProcess process, ITrackCancel trackCancel) &amp;nbsp;&amp;nbsp; at GisViewer.GeoprocessingDialog.&amp;lt;RunSelectedTool&amp;gt;b__0() in C:\TASource\Source\MRA\PACS.NET-1.0\GisViewer\Dialogs\GeoprocessingDialog.cs:line 154&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code I'm using is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; private IFeatureLayer GetSelectedLayers() &amp;nbsp; { &amp;nbsp;&amp;nbsp; foreach (String item in featureList.CheckedItems) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; synchronizer.MapControl.LayerCount; ++i) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var layer = synchronizer.MapControl.get_Layer(i); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layer.Name == item) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return layer as IFeatureLayer; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp; return null; &amp;nbsp; }&amp;nbsp; &amp;nbsp; private IGPProcess GetSelectedTool() &amp;nbsp; { &amp;nbsp;&amp;nbsp; var selectedTool = (GeoprocessorCommand.Command)toolCombo.SelectedItem;&amp;nbsp; &amp;nbsp;&amp;nbsp; if (selectedTool == GeoprocessorCommand.Command.Buffer) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; var tool = new ESRI.ArcGIS.AnalysisTools.Buffer(); &amp;nbsp;&amp;nbsp;&amp;nbsp; tool.in_features = GetSelectedLayers(); &amp;nbsp;&amp;nbsp;&amp;nbsp; tool.out_feature_class = outputText.Text; &amp;nbsp;&amp;nbsp;&amp;nbsp; return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; else if (selectedTool == GeoprocessorCommand.Command.Clip) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; var tool = new ESRI.ArcGIS.AnalysisTools.Clip(); &amp;nbsp;&amp;nbsp;&amp;nbsp; return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; else if (selectedTool == GeoprocessorCommand.Command.Dissolve) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; //var tool = new ESRI.ArcGIS.AnalysisTools. &amp;nbsp;&amp;nbsp;&amp;nbsp; //return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; else if (selectedTool == GeoprocessorCommand.Command.Intersect) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; var tool = new ESRI.ArcGIS.AnalysisTools.Intersect(); &amp;nbsp;&amp;nbsp;&amp;nbsp; return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; else if (selectedTool == GeoprocessorCommand.Command.Merge) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; //var tool = new ESRI.ArcGIS.AnalysisTools &amp;nbsp;&amp;nbsp;&amp;nbsp; //return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; else if (selectedTool == GeoprocessorCommand.Command.Union) &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; var tool = new ESRI.ArcGIS.AnalysisTools.Union(); &amp;nbsp;&amp;nbsp;&amp;nbsp; return tool; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; return null; &amp;nbsp; }&amp;nbsp; &amp;nbsp; private void RunSelectedTool() &amp;nbsp; { &amp;nbsp;&amp;nbsp; new Thread(new ThreadStart( &amp;nbsp;&amp;nbsp;&amp;nbsp; delegate() &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var processor = new Geoprocessor(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var tool = GetSelectedTool();&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tool != null) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var results = (IGeoProcessorResult)processor.Execute(tool, null); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results.Status == ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; results.OutputCount; ++i) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var outputVal = results.GetOutput(i); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (outputVal is DEFeatureClass) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show("There was an error while running the geoprocessor", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; )).Start(); &amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm only testing the Buffer tool currently. I've checked, and the tool has both the in_features and out_feature_class assigned correctly before running the process. Any clues?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;George Faraj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 14:41:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401016#M10698</guid>
      <dc:creator>GeorgeFaraj</dc:creator>
      <dc:date>2012-08-14T14:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401017#M10699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One of the required properties you have to set for the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/#/Members/004w0000006r000000/" rel="nofollow" target="_blank"&gt;Buffer tool&lt;/A&gt;&lt;SPAN&gt; is the buffer_distance_or_field, either a value or a numeric field. I don't see that property being assigned in your code. Also, when getting an error with one of the geoprocessing tools, the first thing I do is check the results window in ArcMap. It usually tells me why the tool has failed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 14:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401017#M10699</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2012-08-14T14:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401018#M10700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;One of the required properties you have to set for the &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/#/Members/004w0000006r000000/"&gt;Buffer tool&lt;/A&gt; is the buffer_distance_or_field, either a value or a numeric field. I don't see that property being assigned in your code. Also, when getting an error with one of the geoprocessing tools, the first thing I do is check the results window in ArcMap. It usually tells me why the tool has failed.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried specifying it using the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;tool.buffer_distance_or_field = "500 METERS";&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;tool.buffer_distance_or_field = 150;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still getting the same exception being thrown. Since I'm using the ArcGIS Runtime Engine, I can't see the results in the ArcMap application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any other ideas? Thanks for the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 18:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401018#M10700</guid>
      <dc:creator>GeorgeFaraj</dc:creator>
      <dc:date>2012-08-14T18:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401019#M10701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should add some code to see what the messages in your results variable contain. Here's how I have it in one of my applications.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim ErrorMessage As String

Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status &amp;lt;&amp;gt; ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Result.MessageCount &amp;gt; 0 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Count As Integer = 0 To Result.MessageCount - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorMessage += Result.GetMessage(Count)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ErrorMessage, "Geoprocessor failed")
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
End If
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:17:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401019#M10701</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T18:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401020#M10702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Apparently, it's a problem if the output file already exists. It works if I specify a file name that doesn't exist. Thanks for all the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 19:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401020#M10702</guid>
      <dc:creator>GeorgeFaraj</dc:creator>
      <dc:date>2012-08-14T19:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unspecified error when running the Buffer tool.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401021#M10703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you don't need to worry about overwriting a file, you can set the IGeoprocessor::OverwriteOutput property to true.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 20:00:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unspecified-error-when-running-the-buffer-tool/m-p/401021#M10703</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2012-08-14T20:00:35Z</dc:date>
    </item>
  </channel>
</rss>

