Select to view content in your preferred language

Geoprocessor not working anymore

629
3
Jump to solution
12-10-2021 01:23 PM
MichaelKohler
Frequent Contributor

I created an add-in earlier this year. Used it for a few months. We went in a different direction but the client and their staff kinda fell short. So I went to go back and use the earlier add-in and now the TableToGeodatabase_conversion breaks pro. There is no error and pro just disappears. This had been working before and I can run the conversion from the Geoprocessing in Pro and Desktop with the same files and it runs fine.

The code always bails at line 10. Nothing is being caught and pro just closes and I get the send report  "ArcGIS Application has stopped working" dialog.

I had upgraded to 2.8 sometime in-between. I upgraded to 2.9 today.

 

Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.AddOutputsToMap = true;
IGeoProcessorResult myresult = new GeoProcessorResult();
IVariantArray parameters = new VarArray();
parameters.Add(Properties.Resources.csvFilePath);
parameters.Add(Properties.Resources.ltGDB);
try
{
	myresult = (IGeoProcessorResult)gp.Execute("TableToGeodatabase_conversion", parameters, null);
	while (myresult.Status == esriJobStatus.esriJobExecuting)
		Thread.Sleep(1000);

	parameters.RemoveAll();
	parameters.Add(Properties.Resources.gdbTablePath);
	parameters.Add("PARCELID");
	parameters.Add("!PARCELID!.replace('a','')");
	myresult = (IGeoProcessorResult)gp.Execute("CalculateField_management", parameters, null);

	gp = null;
}

 

 

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Your code is based on ArcObjects. It cant' work on ArcGIS Pro.

View solution in original post

0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Your code is based on ArcObjects. It cant' work on ArcGIS Pro.

0 Kudos
MichaelKohler
Frequent Contributor

Back in May, everything ran just fine. The add-in has10 different geoprocessing calls in the same format and no problem. It seems that upgrading ArcPro broke this.

I'll try finding a more Pro solution.

0 Kudos
MichaelKohler
Frequent Contributor

This pro addin was partly a port from a desktop addin so some arcobject type code was brought over. I had everything running and then I guess one of the pro updates stopped it from working.

 

var progDlg = new ProgressDialog("Running Table to Table", "Cancel", 100, true);
progDlg.Show();
var progsrc=new CancelableProgressorSource(progDlg);            
var parameters = Geoprocessing.MakeValueArray(Properties.Resources.csvFilePath, Properties.Resources.ltGDB);
await Geoprocessing.ExecuteToolAsync("conversion.TableToGeodatabase", parameters, null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);
progDlg.Hide();
0 Kudos