|
08.08.2012, 03:41 | #1 |
Участник
|
emeadaxsupport: Auto conversion of enums to string error occurs when SysModelMetadata code runs in AX 2012 CIL
Источник: http://blogs.msdn.com/b/axsupport/ar...-2012-cil.aspx
============== We recently came across an issue when we are interrogating the model metadata through a batch process (which uses CIL), in Microsoft Dynamics AX 2012/ 2012 Feature Pack. We get the following error: The expected type was str, but the encountered type was enum. The issue is isolated to the class SysModelMetaData. The new() method of this class instantiates two of its Map objects using the wrong data types for the map key value. xRefKind2Concept = new Map(Types::String, Types::Class); utilElementType2Concept = new Map(Types::String, Types::Class); Changing the code as highlighted below, helps to workaround this error: private void new() { concepts = new List(Types::Class); groupingNodes = new List(Types::Class); path2Image = new Map(Types::String, Types::Integer); path2GroupNodeType = new Map(Types::String, Types::Enum); xpoToken2Concept = new Map(Types::String, Types::Class); /* xRefKind2Concept = new Map(Types::String, Types::Class); utilElementType2Concept = new Map(Types::String, Types::Class); */ xRefKind2Concept = new Map(Types::Enum, Types::Class); utilElementType2Concept = new Map(Types::Enum, Types::Class); //If the init mehtod isn't compiled ok, it will prevent the AOS from starting if invoked if (new SysDictMethod(UtilElementType::ClassInstanceMethod, classNum(SysModelMetaData), methodStr(SysModelMetaData, init)).compiledOk()) { this.init(); } else { throw error(strFmt("@SYS86011", strFmt("%1.%2()", classStr(SysModelMetaData), methodStr(SysModelMetaData, init)))); } super(); } --author: Mansour Yahya Mohamad Источник: http://blogs.msdn.com/b/axsupport/ar...-2012-cil.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|