```
public class StudentInfo
{
public string Name
{ get; set; }
public int Age
{ get; set; }
}
public static void Main()
{
using (var engine = new JScriptEngine("abcaasfgggg", WindowsScriptEngineFlags.EnableDebugging))
//using (var engine = new V8ScriptEngine(typeof(ClearScriptConsole).Name, V8ScriptEngineFlags.EnableDebugging))
{
//engine.AddHostObject("host", new ExtendedHostFunctions());
//engine.AddHostObject("lib", HostItemFlags.GlobalMembers, new HostTypeCollection("mscorlib", "System", "System.Core", "ClearScript"));
engine.AllowReflection = true;
// expose a host type
engine.AddHostType("Console", typeof(Console));
engine.AddHostType("StudentInfo", typeof(StudentInfo));
engine.Execute(@"Console.WriteLine('{0} is an interesting number.', Math.PI);
var studentInfo = new StudentInfo();
studentInfo.Name=""aaa"";
studentInfo.Age = 546;
function print(x) { Console.WriteLine(x); }
");
// call a script function
var kk1 = engine.Script.studentInfo;
engine.Script.print(DateTime.Now.DayOfWeek);
//Get an exception on here. when change engine to V8 that works.
}
}
```
Comments: Fixed in [Version 5.3.1](https://clearscript.codeplex.com/SourceControl/changeset/db89da65e8bc78cc0a53a4a3035cf9f42350d127).
public class StudentInfo
{
public string Name
{ get; set; }
public int Age
{ get; set; }
}
public static void Main()
{
using (var engine = new JScriptEngine("abcaasfgggg", WindowsScriptEngineFlags.EnableDebugging))
//using (var engine = new V8ScriptEngine(typeof(ClearScriptConsole).Name, V8ScriptEngineFlags.EnableDebugging))
{
//engine.AddHostObject("host", new ExtendedHostFunctions());
//engine.AddHostObject("lib", HostItemFlags.GlobalMembers, new HostTypeCollection("mscorlib", "System", "System.Core", "ClearScript"));
engine.AllowReflection = true;
// expose a host type
engine.AddHostType("Console", typeof(Console));
engine.AddHostType("StudentInfo", typeof(StudentInfo));
engine.Execute(@"Console.WriteLine('{0} is an interesting number.', Math.PI);
var studentInfo = new StudentInfo();
studentInfo.Name=""aaa"";
studentInfo.Age = 546;
function print(x) { Console.WriteLine(x); }
");
// call a script function
var kk1 = engine.Script.studentInfo;
engine.Script.print(DateTime.Now.DayOfWeek);
//Get an exception on here. when change engine to V8 that works.
}
}
```
Comments: Fixed in [Version 5.3.1](https://clearscript.codeplex.com/SourceControl/changeset/db89da65e8bc78cc0a53a4a3035cf9f42350d127).