Put a break point here:
VMInfo vmInfo = DataUtil.GetVMInfo(vm);
and step into the function
, if possible.
If that is not possible stop on the break point, right click on vm and choose "quick watch". you can analyze the object. Note the properties and stop again the second time in the loop. Note the properties again and compare.
It is possible
is null, but since it exists in the first loop, I doubt the culprit lies here.
Hope this helps.