InvalidCastException converting class with System.Type property

Issue #15 resolved
tmmueller
created an issue

I tried to convert this class:

[TsClass]
public class Example
{
    public System.Type Type { get; set; }
}

And I got this error:

Error   3   Running transformation: System.InvalidCastException: Specified cast is not valid.
   at TypeLite.TsModels.TsEnum.<GetEnumValues>b__1(FieldInfo field) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModels\TsEnum.cs:line 81
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at TypeLite.TsModels.TsEnum..ctor(Type clrType) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModels\TsEnum.cs:line 57
   at TypeLite.TsModels.TsProperty..ctor(PropertyInfo clrProperty) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModels\TsProperty.cs:line 54
   at TypeLite.TsModels.TsClass.<.ctor>b__1(PropertyInfo pi) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModels\TsClass.cs:line 66
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at TypeLite.TsModels.TsClass..ctor(Type clrType) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModels\TsClass.cs:line 63
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 71
   at TypeLite.TsModelBuilder.AddReferences(TsClass classModel) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 133
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 78
   at TypeLite.TsModelBuilder.AddReferences(TsClass classModel) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 133
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 78
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 71
   at TypeLite.TsModelBuilder.AddReferences(TsClass classModel) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 133
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 78
   at TypeLite.TsModelBuilder.Add(Assembly assembly) in c:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 107
   at Microsoft.VisualStudio.TextTemplating106856ED4D01480CD682F1A45E51EF8FA205492E09A07775DCEB74890BBC319F56E7AD04913B932B8BB02A52C8BB11647D5404A66EA52A3E5DEFA97EC48BD9E7.GeneratedTextTransformation.TransformText() C:\Users\tmueller\Source\Repos\CareSeed\CareSeed\HarvestWebRole\Scripts\TypeLite.tt 1   1   HarvestWebRole