Closed Xriuk closed 1 year ago
Docs are not updated, Using ITypedConstant for every possible type caused too many unforeseen breaking changes, so its usage was restricted only for enums for now.
Here is another TypedConstant bug:
var jsonConverterAttribute = property.Attributes?.FirstOrDefault(x => x.FullName == "Newtonsoft.Json.JsonConverterAttribute");
if (jsonConverterAttribute != null && jsonConverterAttribute.Arguments.Any(x => x.Value.ToString() == "HighPrecisionDecimalConverter"))
{
return "string";
}
The code .Any(x => x.Value.ToString() == "HighPrecisionDecimalConverter")
causes error TypedConstant is an array. Use Values property.
@xumix, it would be nice to have a separate issue for this and also it would also be nice if that issue contained everything needed to reproduce a bug.
@xumix, it would be nice to have a separate issue for this and also it would also be nice if that issue contained everything needed to reproduce a bug.
Done in #92
When casting the
IAttributeArgument.Value
toITypedConstant
i got an error saying "int cannot be casted to ITypedConstant", so I checked and here: https://github.com/NeVeSpl/NTypewriter/blob/7928b542199daf13a4bf6fade55c3ced2dfd63aa/NTypewriter.CodeModel.Roslyn/TypedConstant.cs#L30-L41 It looks that it's not always creating anITypedConstant
, but it can also be anINamedType
or even just a plain object with the actual value.So I don't know if the docs are not updated or there is an error in the code above https://github.com/NeVeSpl/NTypewriter/blob/master/Documentation/CodeModel.md#iattributeargument