-
-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YamlMember Alias usage #849
Comments
It could be the deserializerbuilder options that are set. Can you try deserializing it by itself without the configuration stuff? something like What library/code are you using to add the yaml file to the configuration object? |
I tried to deserializing it by itself and it didn't work without Looks like you are right about deserializerbuilder options affecting this. |
I'm using generic host configuration for adding yaml file to the config object: builder.ConfigureAppConfiguration(options =>
{
options.AddYamlFile("config.yml", false);
options.AddYamlFile("language.yml", false);
}); This is used for a Discord.NET bot which is not supported by generic host by default, so I use |
Since we've narrowed it down to whatever the library you are using to add the Yaml to your configuration is doing and not an issue with YamlDotNet, I'm going to close this issue. |
I use YamlDotNet to read data from a config file like this:
I try to deserialize it to a list of objects like this using IConfiguration:
When I read ranks from a configuration this way it doesn't work. Image property is always
null
. It looks like[YamlMember(Alias = "image-path")]
is getting ignored when file is deserizlized.I tried to change
image-path
property in my config toimage
like thisAnd it works properly.
Image
property is getting deserialized to it's config value.How can I fix this? Is there another attribute for deserialization?
I use YamlDotNet
13.3.1
net6.0
The text was updated successfully, but these errors were encountered: