Extension state not being updated

Discussion created by rockzZ25 on Sep 19, 2011
Latest reply on Mar 5, 2012 by svasa
Hi All,

I have the code below in an Addin extension.

            IExtensionManager pExtMgr;
            IExtension pExt;
            IExtensionConfig pExtCfg;

            pExtMgr = ArcMap.Application as IExtensionManager;
            if (pExtMgr != null)
                for (int i = 0; i < pExtMgr.ExtensionCount - 1; i++)
                    pExt = pExtMgr.Extension[i];
                    if (pExt is IExtensionConfig)
                        pExtCfg = pExt as IExtensionConfig;

                        if (pExtCfg.ProductName == "Extension A" ||
                            pExtCfg.ProductName == "Extension B" ||
                            pExtCfg.ProductName == "Extension C")
                            pExtCfg.State = esriExtensionState.esriESEnabled;

I have checked the code and for the three Extensions list, the if condition is true and the command for setting the state to enable runs but for some reason, they are not enabled.

This code has been placed in the OnStartup() in an Addin extension.

Anyone have any ideas as to why the enabled state is applied or updated.