I have a weird behavior of class that implements IDynamicMetaObjectProvider interface. I posted complete code for the class that causes a problem at StackOverflow:
http://stackoverflow.com/questions/20745780/idynamicmetaobjectprovider-getmetaobject-is-not-always-called
As you can see, a very simple implementation of IDynamicMetaObjectProvider results in a situation when GetMetaObject is not always called on an attempt to bind a dynamic property. The failure it not random: I see the pattern and can reproduce the failure in the following test:
[Test]publicvoidTest(){var dict =new[]{newDictionary<string,object>(){{"StringProperty","a"},{"IntProperty",1}},newDictionary<string,object>(){{"StringProperty","b"},{"IntProperty",2}},};var values =(dict.Select(x =>newDynamicDataEntry(x))asIEnumerable<dynamic>).ToArray();for(int index =0; index < values.Count(); index++){// GetMetaObject is called only first time for the line below, so it is "a" for both iterations! WHY?!!var s = values[index].StringProperty;switch(index){case0:Assert.AreEqual("a", values[index].StringProperty);Assert.AreEqual("a", s);break;case1:Assert.AreEqual("b", values[index].StringProperty);Assert.AreEqual("b", s);break;}}}
Any ideas what might cause such weird behavior?
Thanks in advance.
Vagif Abilov
Vagif Abilov