Now the following code produces SHARPYAML002:
YamlSerializer.Serialize(new MyConfig(), MyYamlContext.Default.MyConfig);
public class MyConfig
{
public Bar Foo { get; set; } // error SHARPYAML002: Type 'MyConfig' contains member 'Foo' of unsupported type 'global::Bar'. Add [YamlSerializable(typeof(global::Bar))] to the context or change the member type.
}
public class Bar;
[YamlSerializable(typeof(MyConfig))]
internal partial class MyYamlContext : YamlSerializerContext;
Is it possible to have it automatically infer the types required for member properties/fields, similar to STJ (As they mentioned in the release notes: The source generator also supports nested object and collection members on objects, not just primitive types.)?
That would be very convenient, as we would only need to specify the outermost type, MyConfig, and it would also eliminate the need for the SHARPYAML002 analyzer.
Just my suggestion; if you don't plan to do it, feel free to close the issue.
Now the following code produces
SHARPYAML002:Is it possible to have it automatically infer the types required for member properties/fields, similar to
STJ(As they mentioned in the release notes: The source generator also supports nested object and collection members on objects, not just primitive types.)?That would be very convenient, as we would only need to specify the outermost type,
MyConfig, and it would also eliminate the need for theSHARPYAML002analyzer.Just my suggestion; if you don't plan to do it, feel free to close the issue.