Type t = Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory.1");//("{DD48C96A-D92A-11D1-AA81-00C04FA33A15}"); System.Object obj = Activator.CreateInstance(t);
I'm having the exact same issue with my windows console EXE in C# for 10.2.1.3497 - even the part where it works sometimes but not every time! Some times it works just fine. Others it fails with that same error:
Creating an instance of the COM component with CLSID {5374EC4C-1AA2-4829-A811-DE624ECEC23F} from the IClassFactory failed due to the following error: 80010105.System.Runtime.InteropServices.COMException (0x80010105): Creating an instance of the COM component with CLSID {5374EC4C-1AA2-4829-A811-DE624ECEC23F} from the IClassFactory failed due to the following error: 80010105.
at ESRI.ArcGIS.Geoprocessor.Geoprocessor..ctor()
I'm checking out an Advanced license at the beginning so that part is working fine.
I'm referencing the following .net assemblies:
ESRI.ArcGIS.Geoprocessing
C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\DotNet\ESRI.ArcGIS.Geoprocessing.dll
runtime v2.0.50727
version 10.2.0.0
ESRI.ArcGIS.Geoprocessor
C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\DotNet\ESRI.ArcGIS.Geoprocessor.dll
Here's my code (it fails right on that first line when executing that Geoprocessor() constructor):
Geoprocessor GP <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Geoprocessor</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> IGeoProcessorResult processorResult <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> createFileGDBTool <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">CreateFileGDB</SPAN><SPAN class="punctuation token">(</SPAN>exportFolder<SPAN class="punctuation token">,</SPAN> fileGdbName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> processorResult <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>IGeoProcessorResult<SPAN class="punctuation token">)</SPAN>GP<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Execute</SPAN><SPAN class="punctuation token">(</SPAN>createFileGDBTool<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> gpTool <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">FeatureClassToFeatureClass</SPAN><SPAN class="punctuation token">(</SPAN>inputtable<SPAN class="punctuation token">,</SPAN> fullExportPath<SPAN class="punctuation token">,</SPAN> fileGdbTableName<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN> processorResult <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>IGeoProcessorResult<SPAN class="punctuation token">)</SPAN>GP<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Execute</SPAN><SPAN class="punctuation token">(</SPAN>gpTool<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Why in the world would it work sometimes and not every time?
Are you creating it repeatedly in a loop?Did you try calling Marshal.ReleaseCOMobject on it once you're finished with it?
Hi Kirk-2 questions: What is the GUI for the Geoprocessor object not GeoProcessor? I was using Geoprocessor object because its execute method only takes 2 arguments.If I have to use GeoProcessor then the first parameter required is string Name. What is Name? The Name of the tool? FeatureClassToFeatureClass_Conversion?
Please elaborate.
What is the GUI for the Geoprocessor object not GeoProcessor?
Here's the key I have (on Vista64):HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{5374EC4C-1AA2-4829-A811-DE624ECEC23F}Do you have this key (or its 32 bit equivalent) ?Does this code work for you?public static void TestGp() { Guid g = new Guid("5374EC4C-1AA2-4829-A811-DE624ECEC23F"); Type t = Type.GetTypeFromCLSID(g); Debug.Print(t.ToString()); GeoProcessor gp = Activator.CreateInstance(t) as GeoProcessor; Debug.Print(gp.OverwriteOutput.ToString()); }
public static void TestGp() { Guid g = new Guid("5374EC4C-1AA2-4829-A811-DE624ECEC23F"); Type t = Type.GetTypeFromCLSID(g); Debug.Print(t.ToString()); GeoProcessor gp = Activator.CreateInstance(t) as GeoProcessor; Debug.Print(gp.OverwriteOutput.ToString()); }
Sounds like this might be an install issue ... if you search your registry, do you find this key?If not, consider re-installing.
Creating an instance of the COM component with CLSID {5374EC4C-1AA2-4829-A811-DE624ECEC23F} from the IClassFactory failed due to the following error: 80010105
Below is the code from a Windows service that I wrote a while back. I fully qualified the class names to avoid confusion with the old Geoprocessor class in the Geoprocessing library. ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass fcToFcTool = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass(); fcToFcTool.in_features = featureLayer; fcToFcTool.out_path = outputDirectory; fcToFcTool.out_name = newTableName; if (!string.IsNullOrEmpty(query)) fcToFcTool.where_clause = query; Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gp.Execute(fcToFcTool, null);
ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass fcToFcTool = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass(); fcToFcTool.in_features = featureLayer; fcToFcTool.out_path = outputDirectory; fcToFcTool.out_name = newTableName; if (!string.IsNullOrEmpty(query)) fcToFcTool.where_clause = query; Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gp.Execute(fcToFcTool, null);
I am developing ArcMap extensions quite frequently, but it was never a problem to create an instance in C# with the new keyword. May be you are developing an ArcGIS engine application? In this case, I would try to check out a license before instantiating the geoprocessor object.http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000043p000000The Geoprocessor is not listed, so using the Activator class is not the right way.Best regards, Stefan
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.