It appears that the for/in loop is not working when JScript engine is initialized with WindowsScriptEngineFlags.EnableStandardsMode flag.
I tried adding PropertyBag and ExpandoObject as host objects.
I noticed that there is a ScriptEngineException when executing for/in loop on either of the two objects which has HResult of 0x800a0005 (Invalid procedure call or argument).
Without WindowsScriptEngineFlags.EnableStandardsMode flag everything works without exceptions.
I am developing on Windows 10 with ClearScript 5.4.3
Here is the sample program:
```
static void Main(string[] args)
{
var engine = new JScriptEngine(WindowsScriptEngineFlags.EnableStandardsMode);
engine.AddHostType("Console", typeof(Console));
dynamic expandoObj = new ExpandoObject();
expandoObj.testProp = "expando testProp Text";
engine.AddHostObject("expandoObj", expandoObj);
var propertyBag = new PropertyBag();
propertyBag["testProp"] = "property bag testProp Text";
engine.AddHostObject("propertyBagObj", propertyBag);
engine.Execute(@"Console.WriteLine('expandoObj.testProp=' + expandoObj.testProp);");
engine.Execute(@"Console.WriteLine('propertyBagObj.testProp=' + propertyBagObj.testProp);");
engine.Execute(@"Console.WriteLine('');");
engine.Execute(@"for (var item in propertyBagObj) Console.WriteLine('propertyBagObj[' + item + ']=' + propertyBagObj[item]);");
engine.Execute(@"Console.WriteLine('');");
engine.Execute(@"for (var item in expandoObj) Console.WriteLine('expandoObj[' + item + ']=' + expandoObj[item]);");
}
```
Comments: Fixed in [Version 5.4.4](https://clearscript.codeplex.com/SourceControl/changeset/4d6048f4be2d433dbfb7de01d05eb5cb33b42007).
I tried adding PropertyBag and ExpandoObject as host objects.
I noticed that there is a ScriptEngineException when executing for/in loop on either of the two objects which has HResult of 0x800a0005 (Invalid procedure call or argument).
Without WindowsScriptEngineFlags.EnableStandardsMode flag everything works without exceptions.
I am developing on Windows 10 with ClearScript 5.4.3
Here is the sample program:
```
static void Main(string[] args)
{
var engine = new JScriptEngine(WindowsScriptEngineFlags.EnableStandardsMode);
engine.AddHostType("Console", typeof(Console));
dynamic expandoObj = new ExpandoObject();
expandoObj.testProp = "expando testProp Text";
engine.AddHostObject("expandoObj", expandoObj);
var propertyBag = new PropertyBag();
propertyBag["testProp"] = "property bag testProp Text";
engine.AddHostObject("propertyBagObj", propertyBag);
engine.Execute(@"Console.WriteLine('expandoObj.testProp=' + expandoObj.testProp);");
engine.Execute(@"Console.WriteLine('propertyBagObj.testProp=' + propertyBagObj.testProp);");
engine.Execute(@"Console.WriteLine('');");
engine.Execute(@"for (var item in propertyBagObj) Console.WriteLine('propertyBagObj[' + item + ']=' + propertyBagObj[item]);");
engine.Execute(@"Console.WriteLine('');");
engine.Execute(@"for (var item in expandoObj) Console.WriteLine('expandoObj[' + item + ']=' + expandoObj[item]);");
}
```
Comments: Fixed in [Version 5.4.4](https://clearscript.codeplex.com/SourceControl/changeset/4d6048f4be2d433dbfb7de01d05eb5cb33b42007).