Mikioo / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

PropertyInfo.PropertyType returns null for array-type properties #308

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It looks like there is a bug in jsclr in the initialization of PropertyInfo for 
properties of array type. PropertyType returns null for array-type properties. 
Please find below how to reproduce:

  [JsType(JsMode.Clr, Filename = "../js/my-class.js")]
  public class MyClass
  {
    Int32 myVariable { get; set; }
    Int32[] myArray { get; set; }
  };

  MyClass myClass = new MyClass();
  Type type = myClass.GetType();
  System.Reflection.PropertyInfo[] propertiesInfo = type.GetProperties();
  foreach (PropertyInfo propertyInfo in propertiesInfo)
  {
     Type propertyType = propertyInfo.PropertyType; // returns null on "myArray" property
  }

It seems that problem is in JsTypeHelper.GetTypeWithArguments that returns null 
if the type name argument does not contain any " ' ". I do not know what this 
check is for, so I can not correct myself.

Original issue reported on code.google.com by DanelK...@gmail.com on 4 Aug 2013 at 1:04