RSS

Map:createFromXML parses incorrecly in IL mode

22 Apr

I need to serialize a Map and convert this back to Map when it reaches server side.  This piece of code works fine if running in XPP but fails in IL. I discovered this bug when i was trying to build code to extract trial balance and pass in dimension ranges map. Since this code has to be run in batch, i need to serialize this Map. I’m able to simplify this issue to the class below.

class MapTest

{
}

public server static void main(Args _args)
{
XppILExecutePermission permission = new XppILExecutePermission();
permission.assert();

runClassMethodIL(classStr(MapTest),
staticMethodStr(MapTest,run),
conNull());

}

public static server container run(container _con)
{
XmlDocument xDoc;
Map dimRangeMap = new Map(Types::Int64, Types::String);
SerializedDimensionRange    serializedDimensionRanges;
dimRangeMap.insert(5637144583, “40000..69999”);
serializedDimensionRanges = dimRangeMap.xml();
info(“BEFORE”);
info(serializedDimensionRanges);
xDoc = new XmlDocument();
xDoc.loadXml(serializedDimensionRanges);
dimRangeMap = new Map(Types::Int64, Types::String);
dimRangeMap = Map::createFromXML(xDoc.root() as XmlNode);
info(“AFTER”);
info(dimRangeMap.xml());
return conNull();
}

image

Hope Microsoft will solve this kernel bug soon

Advertisements
 
4 Comments

Posted by on April 22, 2014 in Development

 

Tags: , , ,

4 responses to “Map:createFromXML parses incorrecly in IL mode

  1. Bryan

    April 28, 2014 at 5:18 pm

    I found this same exact error today when running the Trial Balance summary report in batch vs. client. Good documentation. I am going to submit a support ticket to MS. Did you?

     
    • Hai Nguyen

      April 28, 2014 at 8:45 pm

      Yes, i did create a ticket and Microsoft is working on this. I created few days ago and they just contacted me today. I will keep you posted the solution i find from them. This could be a kernel fix.

       
  2. Bryan

    April 28, 2014 at 6:32 pm

    I thought it might be possible to re-write this method to get a faster response than from a Microsoft fix. In doing so, I found this Global method Global::createMapFromXML, which does the same thing, but actually works in IL. Changing the call to that instead of using the Map class should resolve the issue.

     
    • Hai Nguyen

      April 28, 2014 at 8:52 pm

      Awesome. I wish I could have known this earlier. It took me so much time to to try different ways but then I had to give up. I’m going to give your method a try. Thanks for helping.

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: