-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
Single character string containing special characters causes SyntaxErrorException #269
Comments
This looks like a bug. I'll need some time to look into this. Could you send the full exception message, including the stack trace? Thanks |
|
Any update? |
I just tested this with the following code and it worked fine. using YamlDotNet.Serialization;
var deserializer = new DeserializerBuilder()
.Build();
var yamls = new string[]
{
"commandPrefix: '!'",
"commandPrefix: \"!\"",
"commandPrefix: \"\x21\"",
"commandPrefix: !!str \"!\"",
};
foreach (var yaml in yamls)
{
var deserialized = deserializer.Deserialize<X>(yaml);
Console.WriteLine(yaml + ":" + (deserialized.CommandPrefix ?? "NULL"));
}
public class X
{
[YamlMember(Alias = "commandPrefix")]
public string CommandPrefix { get; set; }
} Results in:
|
If you have a single character string with a special character (in my case an exclamation mark) YamlDotNet will throw a SyntaxErrorException.
commandPrefix: '!'
commandPrefix: "!"
commandPrefix: "\x21"
commandPrefix: !!str "!"
All of the above cause the exception when deserializing. Is this a bug or am I not understanding something about the YAML specification?
commandPrefix: "a!"
The above works correctly but that's because the exclamation mark is the 2nd character and not the 1st.
The text was updated successfully, but these errors were encountered: