AnsweredAssumed Answered

How can I run a geoprocessing tool within a separate thread starting from arcobjects code / ArcMap extension ?

Question asked by u.egger on Feb 20, 2017
Latest reply on Feb 20, 2017 by Dan_Patterson

I have a method that involves among other operations the use of some geoprocessing tools.

Because this method takes some time and the input is not changed while working with the extension,

I want to have it run in a separate thread so that the main (UI) thread is kept available for the user and ArcMap won't freeze.


As soons as the Geoprocessor.Execute method is called, ArcMap crashes.


As I read in a forum on the internet that passing arcobjects to the separate thread I made sure I only pass strings as arguments.


Do I have to use Geoprocessur.ExecuteAsync ? It does not seem to be logical to me since I have to wait for the result until I can proceed with the next operation.


The workflow is approximately:


Foreach timestep

   Take corresponding raster dataset from geodatabase

      Run raster to polygon geoprocessing tool

      Run intersect geoprocessing tool to get intersection of Raster_as_polygon feature class from with another feature class

      Analyze the intersected feature class to obtain the results

Write results to file