david.plume

Geoprocessor Execute HRESULT COM Error

Discussion created by david.plume on Nov 6, 2013
Latest reply on Feb 3, 2014 by blasipeti
Hi Everyone,

Recently, I started having problems with my C# projects running geoprocessing tools.  My tools point to custom scripts in project toolboxes.  The code in question has run without issue in the past.

However, something in my environment has changed and even the simplest code throws errors. Please see sample below.

The code fails on gp.Execute();  I've triple checked, labels, names, paths, parameters etc.

I've tried every thing I can think of to track down this problem including re-installing Arc. 

I'm dead in the water if I can't solve this nasty problem.

Thanks in Advance
David

        

private void runTool()
        {
            try
            {
                
                Geoprocessor gp = new Geoprocessor();
                gp.AddToolbox(@"C:\0_Test\Test.tbx");

                IVariantArray parameters = new VarArrayClass();
                parameters.Add(@"MyStringArg");

                // Execute the tool.
                gp.Execute("test", parameters, null);

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "TestGP Error", System.Windows.Forms.MessageBoxButtons.OK);
                return;
            }
        }

Outcomes