<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cannot create an instance of AppRef in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122696#M3228</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with our cost distance raster.&amp;nbsp; I tried using our methods that worked in 10.0 to add these to the table of contents on the map to see the values returned.&amp;nbsp; However when I all either &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IApplication baseApp = (IApplication)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("E1740EC5-9513-11D2-A2DF-0000F8774FB5")));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or I call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IApplication baseApp = (IAplication)Activator.CreateInstance(Type.GetTypeFromProgID("esriFramework.AppRef"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the same error returned : &lt;/P&gt;&lt;P&gt;Process Failed: System.Runime.InteropServices.COMException.....IClassFactory Failed due to error 8000ffff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen discussions on Stack Overflow that you have to be inside an Arcmap enviroment....however I AM inside an Arcmap environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a new way to do this inside 10.2.2 that these........developers didn't share with us???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2014 23:19:21 GMT</pubDate>
    <dc:creator>MichaelEber</dc:creator>
    <dc:date>2014-08-11T23:19:21Z</dc:date>
    <item>
      <title>Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122696#M3228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with our cost distance raster.&amp;nbsp; I tried using our methods that worked in 10.0 to add these to the table of contents on the map to see the values returned.&amp;nbsp; However when I all either &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IApplication baseApp = (IApplication)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("E1740EC5-9513-11D2-A2DF-0000F8774FB5")));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or I call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IApplication baseApp = (IAplication)Activator.CreateInstance(Type.GetTypeFromProgID("esriFramework.AppRef"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the same error returned : &lt;/P&gt;&lt;P&gt;Process Failed: System.Runime.InteropServices.COMException.....IClassFactory Failed due to error 8000ffff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen discussions on Stack Overflow that you have to be inside an Arcmap enviroment....however I AM inside an Arcmap environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a new way to do this inside 10.2.2 that these........developers didn't share with us???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 23:19:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122696#M3228</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2014-08-11T23:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122697#M3229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't believe you should be &lt;EM&gt;&lt;STRONG&gt;creating&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; &lt;/STRONG&gt;an instance of an IApplication; you should be getting a &lt;EM&gt;&lt;STRONG&gt;hook&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; &lt;/STRONG&gt;to an existing instance (that represents ArcMap itself).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is your code inside of a custom ArcMap extension?&amp;nbsp; If so, there should be an automatically generated &lt;EM&gt;&lt;STRONG&gt;ArcMap&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; &lt;/STRONG&gt;static class that exposes an &lt;EM&gt;&lt;STRONG&gt;Application&lt;/STRONG&gt;&lt;/EM&gt; property.&amp;nbsp; Assuming this is true, the following code would work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IApplicaiton baseApp = ArcMap.Application;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 22:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122697#M3229</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-08-12T22:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122698#M3230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Activator.CreateInstance is how you get a hook into the singleton.&amp;nbsp; I'm running a geoprocessing service as a tool inside Arcmap and as I said before I have done this without issues in ArcMap 10.0.&amp;nbsp; It is now broken in 10.2.2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 22:08:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122698#M3230</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2014-08-12T22:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122699#M3231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I follow you now.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a few variations on the code used to obtain a reference to the IApplication singleton, but nothing fundamentally different.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running 10.2.1 and both approaches work for getting a hook to the IApplication.&amp;nbsp; Besides the ArcDesktop version difference, this code is running from an Add-In as opposed to a Tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does your custom tool implement the ITool interface, or is it derived from BaseTool?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 22:48:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122699#M3231</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-08-12T22:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122700#M3232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We implement our code using IGPFunction2 interface and the IGPFunctionFactory for exposing them to Arcmap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2014 18:53:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122700#M3232</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2014-08-13T18:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122701#M3233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One last idea: have you tried using the IAppROT (running object table) interface from the GP tool to get a hook to ArcMap?&amp;nbsp; Lack of #CODE formatting in the new forums is a bummer, but here is an example of AppROT usage:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IAppROT appRot = new AppROTClass();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; appRot.Count; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (appRot.Item&lt;I&gt;.Name == "ArcMap")&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication arcMapApplication = appRotItem.Item&lt;I&gt; as IApplication;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 20:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122701#M3233</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-08-14T20:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122702#M3234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow!&amp;nbsp; That worked!&amp;nbsp; Nice of ESRi to force us to search for ways to get around their coding screwups.&amp;nbsp; &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like I had nothing better to do.&lt;/P&gt;&lt;P&gt;BTW : Here is the code I implemented -- a bit different from what you did.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IAppROT appRot = new AppROTClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication baseApp = null;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int index = 0; index&amp;lt; appRot.Count; index++)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (appRot.get_Item(index) is ESRI.ArcGIS.Framework.AppRef)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseApp = (IApplication)appRot.get_Item(index);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Erin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 21:39:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122702#M3234</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2014-08-14T21:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create an instance of AppRef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122703#M3235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice!&amp;nbsp; I'm happy this worked for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 21:54:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/cannot-create-an-instance-of-appref/m-p/122703#M3235</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-08-14T21:54:58Z</dc:date>
    </item>
  </channel>
</rss>

