Select to view content in your preferred language

Problems with AppROTClass in 10.2.2 Desktop.

5536
8
09-16-2014 03:11 PM
MarySage
Deactivated User

I am converting an automation utility from ArcMap 9.3 to 10.2.2.  I changed some references and added binding to the Desktop license.  In 9.3 I was able to connect to an existing instance of ArcMap using the following statement:

AppROT rot = new AppROTClass();  // WORKS in 9.3, THROWS EXCEPTION in 10.2.2 

In 10.2.2 this throws a COM exception about the class not existing.  However, in 10.2.2 when I create the instance of ArcMap in my code, the AppROT works. 

IDocument doc =  (IDocument) new ESRI.ArcGIS.ArcMapUI.MxDocumentClass();

AppROT rot = new AppROTClass(); // WORKS in 10.2.2

Does anyone know why I cannot connect to an existing instance of ArcMap in 10.2.2?  Thanks.  Mary Sage

0 Kudos
8 Replies
MarySage
Deactivated User

Now, the above code does not work in 10.2.2.  

I'm getting the exception:

System.Runtime.InteropServices.COMException (0x80040111): Retrieving the COM class factory for component with CLSID {FABC30FB-D273-11D2-9F36-00C04F6BC61A} failed due to the following error: 80040111.

 

Did I mention I'm trying to execute the sample:  DesktopAutomationCS2010?   I added the bind to the Desktop for the license.

Thanks for any help.

0 Kudos
AndryJoos
Regular Contributor

We currently encounter similar error message on 10.2.2 Desktop, however the scenario might be a little bit different:

new AppROTClass() throws the same exception as you get if and only if there's already an instance of AppRot.exe running on the system (under the same user account, with elevated = yes). The programm calling new AppROTClass() is being executed as a windows task scheduler triggered executable.

The second time the task is triggered, the exception hits us (while the first time works and instanciates AppROT.exe). If I kill the AppROT.exe process before the task is triggered the second time, things work well, too.

Of course, the binding is made properly. And creating a new AppROTClass should not need any other licensing, except for the binding to Desktop.

I'm a bit worried about the AppROT.exe running elevated. What else could be involved? The scheduler task is being executed with a user having local administrator privileges (and that might explain the elevation).

Maybe this additional info helps to track this problem down?

0 Kudos
MichaelCiscell
Deactivated User

Have you found a work around for the problem using AppRot with 10.2.2?

0 Kudos
AndryJoos
Regular Contributor

Hi Michael. No, not yet and we have not taken further steps in resolving this (requirements changed and we did not need to find a proper solution). Still, for future projects or implementations, it would obviously be good if there'd be a solution to this.

0 Kudos
MichaelCiscell
Deactivated User

Thanks Andry. So everything you’ve seen indicates this is an esri problem?

0 Kudos
AndryJoos
Regular Contributor

I wouldn't vouch for it, but yes. It looks like broken behaviour or wrong documentation or something along these lines. Of course, I might also be doing something wrong after all.

0 Kudos
by Anonymous User
Not applicable

Andry,

I think its a security issue that started with vista, see AppROT and Windows Vista

For me, the following only works if both arcmap and the console app are running at the same permissions (both elevated or both not, but not a mix). If they're different, I get the error.

      //find Arcmap and change title
      IApplication app = null;
      IAppROT appRot = new AppROTClass();
      for (int i = 0; i < appRot.Count; i++)
      {
        if (appRot.get_Item(i) is IMxApplication)
        {
          app = appRot.get_Item(i);
          app.Caption = "Connected";
        }
      }
      if (appRot == null)
      {
        MessageBox.Show("unable to find arcmap");
      }

Maybe try an application manifest?

Sean

MichaelCiscell
Deactivated User

Thanks Sean. As it turns out, what we needed was whether there is Arc running and what level is being used (AI, AE or AV). Found out that we have a file from the license manager that tells us that.

I will pass this on to the developer to watch for this issue in the future.

Michael

0 Kudos