NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
126 stars 24 forks source link

AttributeArgument with null value, TypedConstant ToString throws NullReferenceException #87

Closed Xriuk closed 1 year ago

Xriuk commented 1 year ago

I have an attribute which receives a null argument, and when retrieving it from the model, it retrieves the AttributeArgument but it throws when I try to print it, because the Value inside it is null. I guess the problem is here: https://github.com/NeVeSpl/NTypewriter/blob/23a40b936caf1a2682bc97500de407bd6e30884a/NTypewriter.CodeModel.Roslyn/TypedConstant.cs#L35C78-L35C78 Because the typedConstant itself is not null, but its Value property is

NeVeSpl commented 1 year ago

Indeed, thank you for noticing that.