Created
June 8, 2020 00:00
-
-
Save haacked/fe3624b3231e08d135073d8ce68c1e20 to your computer and use it in GitHub Desktop.
JsonConvert Bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void StackTest() | |
{ | |
var stack = new Stack<string>(); | |
stack.Push("one"); | |
stack.Push("two"); | |
stack.Push("three"); | |
var serialized = JsonConvert.SerializeObject(stack, new JsonSerializerSettings | |
{ | |
TypeNameHandling = TypeNameHandling.All | |
}); | |
var deserialized = JsonConvert.DeserializeObject<Stack<string>>(serialized); | |
Assert.Equal("three", deserialized.Pop()); // This fails because `Pop()` returns "one" here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Known issue: JamesNK/Newtonsoft.Json#1596