node-clr
node-clr copied to clipboard
Problems with System.Console
This works:
System.Console.Write(12)
This, on other hand, does not (TargetParameterCountException, yet this is perfectly legal call):
System.Console.Write('12')
...This code seems to be OK, though o_O:
System.Console.Write('12', undefined)
Funnily enough, following code throws exception too:
System.Console.WriteLine(12)
ArgumentException: Невозможно преобразовать объект типа "System.Int32" к типу "System.Decimal". в System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) в System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) в System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) в System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) в System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) в CLRBinder.InvokeMethod(Localv8::Value* , Type type, String name, Object target, Localv8::Array args) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 82 в CLRBinder.InvokeMethod(Localv8::Value* , Localv8::Value typeName, Localv8::Value name, Localv8::Value target, Localv8::Value args) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 62 в CLR.InvokeMethod(FunctionCallbackInfov8::Value* info) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\node-clr.cc:строка 322
This code produces huge memory spike (up to 6GB on my Win10), resulting in SEHException:
System.Console.WriteLine(System.ConsoleColor.Aqua)
Exception goes as following, no undefined color being mentioned:
SEHException: Внешний компонент создал исключение. в v8.Object.GetOwnPropertyNames(Object* , Localv8::Array* ) в ChangeType(Localv8::Value value, Type type, Int32* match) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\marshal.cc:строка 325 в CLRBinder.BindToMethod(MethodBase method, Localv8::Array args, Int32& match) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 324 в CLRBinder.SelectMethod(MethodBase[] methods, Localv8::Array args) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 189 в CLRBinder.InvokeMethod(Localv8::Value* , Type type, String name, Object target, Localv8::Array args) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 82 в CLRBinder.InvokeMethod(Localv8::Value* , Localv8::Value typeName, Localv8::Value name, Localv8::Value target, Localv8::Value args) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\clrbinder.cc:строка 62 в CLR.InvokeMethod(FunctionCallbackInfov8::Value* info) в c:\users\guevara-chan\appdata\roaming\npm\node_modules\clr\src\node-clr.cc:строка 322
This works as intended, though:
console.log(System.ConsoleColor.Aqua)
This, on other hand, does not (TargetParameterCountException, yet this is perfectly legal call): System.Console.Write('12')
This seems as a bug around variable length argument. (System.Console.Write(string format, params object[] args))
I'm checking on this.
Seems that varargs binding is not working properly.
Fixing this will take some time, so, for now please avoid using varargs and
use normal binding. (like System.Console.WriteLine("fmt", [])
)
This code produces huge memory spike (up to 6GB on my Win10), resulting in SEHException:
see #4.