Taking off STAThread is not the solution, it will seriously impact the application to be thread unstable and impact the performance a lot. The solution to this is to properly execute the GeoProcessing tools. Within this module, assign NULLs and release all objects properly. I had this problem for awhile, and this resolved my issue with running GeoProcessing tools within my Console Application.
public static void RunTool(Geoprocessor geoprocessor, IGPProcess process, ITrackCancel TC)
{
// Set the overwrite output option to true
geoprocessor.ClearMessages();
geoprocessor.OverwriteOutput = true;
// Execute the tool
try
geoprocessor.Execute(process, null);
ReturnMessages(geoprocessor);
geoprocessor = null;
process = null;
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(geoprocessor);
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(process);
}
catch (Exception err)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.