i am using the arcGIS api to make a plugin for arcFM, when i try to run this code

 Type t = Type.GetTypeFromProgID("esriFramework.AppRef");
                System.Object obj = Activator.CreateInstance(t);
                pApp = obj as IApplication;

i get

System.Runtime.InteropServices.COMException(0x8000FFFF): Creating an instance of the component with CLSID {Appref CLSID HERE} from the IClassFactory faileddue to the following error: 8000ffff
  • Can you do a createinstance on other Esri types (e.g. esriGeometry.Point), or just having problems with AppRef? – Kirk Kuykendall Apr 25 '11 at 20:25
  • Is this in a dll project? I wouldn't expect it to work in an exe project. – Kirk Kuykendall Apr 25 '11 at 20:26
  • What kind of ArcFM extension are you developing? Is it an autoupdater? If that's the case, you should never rely on the IApplication being present since AUs can also be run in different context than an ESRI desktop application. – Petr Krebs Apr 25 '11 at 21:40

Looks like you might not have initialized the ESRI ArcObjects libraries. You have to do that, to get your license set. You need to check here; ESRI Library to make sure you are getting the libraries started up properly.

  • I am using the example code from MMStartup.cs and the exact same code seems to work fine there – Eric Fode Apr 25 '11 at 20:00
  • 1
    Ok, Looks like I missed this - '{Appref CLSID HERE}' - to me this is looking like its not seeing your extension being registerd with ArcGIS, so it may be trying to get to your custom code and isn't knowing what to start up. – D.E.Wright Apr 25 '11 at 20:20

Assuming that you are running the code within an ESRI-app process (e.g. ArcMap, ArcCatalog), if you need to get a reference to a running IApplication from a standalone application, you can use the AppROT class.

  • how do i use the AppROT class? – Eric Fode Apr 26 '11 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.