C
C#2mo ago
Ruttie

XML deserialization with AOT

Is it possible to deserialize XML when using AOT? The default XmlSerializer relies on reflection and thus does not support AOT. Perhaps there are packages that utilize a source generator to implement a deserializer?
3 Replies
Angius
Angius2mo ago
GitHub
GitHub - ZingBallyhoo/StackXML: Stack based zero-allocation XML ser...
Stack based zero-allocation XML serializer and deserializer powered by C# 9 source generators - ZingBallyhoo/StackXML
Angius
Angius2mo ago
Only thing I could find
Angius
Angius2mo ago
Well, Microsoft does have a generator as well, but it's not fully AOT and trimming compatible, I believe: https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator
Microsoft XML Serializer Generator - .NET
An overview of the Microsoft XML Serializer Generator. Use the XML Serializer Generator to generate an XML serialization assembly for the types contained in your project.

Did you find this page helpful?