neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.35k stars 266 forks source link

Crashes under .Net 5 #235

Open IamIC opened 3 years ago

IamIC commented 3 years ago

The following throws an exception under .Net 5 / C# 9:

        class Person
        {
            public Person() { }

            public Person(int age, string name, Person[] data)
            {
                Age = age;
                Name = name;
                Data = data;
            }

            public int Age { get; set; }
            public string Name { get; set; }
            public Person[] Data { get; set; }
        }

        private void Test()
        {
            var p = new Person(99, "acrobat", new Person[]
                {
                    new Person(1, "abc", null),
                    new Person(2, "xyz", null)
                });
            p = new Person(99, "acrobat", new Person[]
                {
                    new Person(1, "abc", new Person[] { p }),
                    new Person(2, "xyz", null)
                });

            // throws exception
            var result = JsonSerializer.Serialize(p);

            var p2 = JsonSerializer.Deserialize<Person>(result);
        }
Pete-PlaytimeSolutions commented 3 years ago

Is there any plans to continue development of this project?

kamyker commented 3 years ago

try https://github.com/Cryptisk/Utf8Json