SamboyCoding / Tomlet

Zero-Dependency, model-based TOML De/Serializer for .NET
MIT License
155 stars 29 forks source link

Add better constructor support for deserialization #32

Closed tcortega closed 1 year ago

tcortega commented 1 year ago

The behaviour in the mechanism is based on the behaviour observed on the System.Text.Json library, when attempting to deserialize JSON strings.

if there is anything wrong with it, let me know or feel free to change it yourself.

coveralls commented 1 year ago

Coverage Status

coverage: 92.162% (-0.2%) from 92.402% when pulling 619ebc0d50d601481c0df6f59fe1d59c8acb2134 on tcortega:feat/constructor-initialization into 729f57bb51eb973f7c3f534d56d6c4ace29e2fd7 on SamboyCoding:master.

tcortega commented 1 year ago

When I moved the GenericExtensions as you said, to the Extensions folder, there seemed to be an issue with using the Extension methods in the TomlCompositeDeserializer.cs, an error saying.

Ambiguous invocation:   Tomlet.Attributes.TomlNonSerializedAttribute GetCustomAttribute<TomlNonSerializedAttribute>(this System.Reflection.MemberInfo) (in class CustomAttributeExtensions)   Tomlet.Attributes.TomlNonSerializedAttribute? GetCustomAttribute<TomlNonSerializedAttribute>(this System.Reflection.MemberInfo) (in class GenericExtensions) match

Therefore it is now calling the method in the static class directly.