Closed danielo-unity3d closed 6 months ago
I don't understand the use case completely. The generated classes are intended to be used with XmlSerializer
so if that's compatible with native AOT it should work. I don't think the generated classes themselves contain any code that requires reflection. The classes are already partial
.
I think what @danielo-unity3d means is an automatic implementation of the IXmlSerializable interface. When the XmlSerializer discovers that a class has implemented this interface the interface code is used rather than reflection based serialization. This can make the serialization and deserialization an order of magnitude faster.
We want the C# code generated from our XSD description (imported into the
ModelBuilder
) to be either trimmable (already possible?), or not need reflection at all (targetable from NativeAOT)?My understanding is that a
CodeDom
is built from the XSD (theModelBuilder
).So either, the generated classes are:
IXmlSerializable
(or some other scheme),and then:
partial
, leaving the implementation or the read and write up to the dev, orI know that we have access to the code and that anything is possible, but I'm looking for guidelines that would perhaps help accelerate the effort, or dissuade me from the undertaking. Has anyone ever asked for anything similar? Thanks