YamlDotNet
YamlDotNet copied to clipboard
AOT fails to parse Uri types
trafficstars
Describe the bug
When using AOT (Vecc.YamlDotNet.Analyzers.StaticGenerator), if the model uses Uri, it fails on any input (Unhandled exception. (Line: 4, Col: 1, Idx: 41) - (Line: 4, Col: 8, Idx: 48): Exception during deserialization).
To Reproduce
[YamlStaticContext]
public partial class YamlContext;
[YamlSerializable]
public class MyModel
{
public Uri BaseUrl { get; set; }
// public string BaseUrl { get; set; } // string is OK
}
var deserializer =
// new DeserializerBuilder() // without AOT
new StaticDeserializerBuilder(new YamlContext()) // with AOT
.Build();
yaml = @"BaseURL: http://localhost.com";
var myModel = deserializer.Deserialize<MyModel>(yaml); // Exception