0

So I noticed a big performance hit when I add the following line to my code:

ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.EngineOrDesktop);

I have two separate classes that call the BindLicense method. After the first time it is called, it isn't necessary to call again, but neither class can assume that has happened. What I want to know is if there is a cheaper way of checking if a license exists before attempting to bind?

I feel like I've seen code to do this in Python, but don't know if there is the equivalent in ArcObjects...

1

Check the ActiveRuntime property first? Is it really slow with each subsequent call? I can see you taking a hit the first time as it loads the ArcObjects DLLs, but subsequent calls should be faster.

  • I'll try checking the ActiveRuntime property. I figured it wouldn't matter on subsequent calls either. Originally I just had one place where it called BindLicense, but ended up adding another and in doing so, tacked on an additional 5 seconds. – lintmouse Oct 25 '13 at 19:01
2

I would create a global class that fires on AppStart, have it check the license and then persist through the entire AppSession. This way you only need worry about the initial start to check-out then before AppExit check-in.

  • Yeah, that is how it works currently. But I don't want the two classes to assume that will always be the case. So I would like for them to be able to inexpensively check and if there isn't a license checked out, check it out. – lintmouse Oct 25 '13 at 18:59
  • 2
    How about checking this? ESRI.ArcGIS.RuntimeManager.ActiveRuntime == null, if null then you can make your license call. – D.E.Wright Oct 25 '13 at 19:22

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.