I was just going to leave this as a minor thing, but it's getting really cumbersome. When I use the geoprocessing tool, "CreateDatabaseConnection_management", to create an SDE connection in my Add-In app, the connected SDE geodatabase is populated with "randomly-assigned" tables, instead of the actual tables contained in the database.
Running the tool in the Geoprocessing tab, however, the SDE database connection is populated with correct tables. Is this a bug in the SDK? Below is my code snippet:
//Create a new sde connection
try
{
ProgressDialog progDlg = new ProgressDialog("Creating Database Connection...", "Cancel", 100, true);
progDlg.Show();
//Execute a GP tool
IReadOnlyCollection<string> args = Geoprocessing.MakeValueArray(workDir, connName, server, instance, "OPERATING_SYSTEM_AUTH", dbName, sdePath);
IGPResult gp_result = await Geoprocessing.ExecuteToolAsync("CreateDatabaseConnection_management", Geoprocessing.MakeValueArray(args.ToArray()),
null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create database connection: " + ex.Message, "Error Message", MessageBoxButton.OK, MessageBoxImage.Error);
}