Testura/Testura.Code

Bug: generation of nullable types

Closed this issue · 4 comments

Nullable types generate correctly only for primitives, for other types it generates it wrongly:

public Nullable`1Property { get; set; }
classProperties.Add(new AutoProperty(propertyName, typeof(DateTime?), PropertyTypes.GetAndSet, modifiers, propertyAttributes));`

Thanks for reporting. I will look into it.

Hey,

The bug is fixed and I released a new 0.9.0 release.

That's cool it works fine now. Isn't there any way to make it universal ? Other than checking for each type like

0bed2b2#diff-24486341b30753e4810405e00dc12b3cR132

It still doesn't work for many other types, like short? etc. So I think that doesn't really solve the issue.

oh, that's just bad. I have totally missed short. And I even have ushort :/

https://github.com/Testura/Testura.Code/blob/master/src/Testura.Code.Tests/Generators/Common/TypeGeneratorTests.cs

Nullable is a bit of a special case so I tried to do it just for "Predefined types" as you usually don't use it for anything else. But maybe I have to check for a better and more universal solution as you say.