Friday, August 21, 2015

Extension Framework and SysGlobalCache issue

There is a new extension framework in AX 2012 that facilitates developing customized class hierarchies by using attributes for instantiating the needed descendant.

I used this simple and brilliant article by Joris de Gruyter while creating all the needed artefacts to test the framework.

Unfortunately, his remark in bold not to forget to Refresh elements after adding a new attribute value for a new descendant class did not help: my test class still instantiated my base TmxDynamics class!

After debugging I found that the Refresh elements does not actually flush StaticMaps for values in GlobalCache.

Neither does SysExtensionCache::clearAllScopes() nor SysFlushAOD::clearGlobalCaches() actually flush the  "SysExtAppClassSearchStratDepth.checkDerivedClasses", which is responsible for finding all inherited classes.

I do not know if this is a Microsoft bug, but if you cannot manage to get your newly added class, try to flush this value from the global cache.

I got what I want.

Happy cache-flushing!