-
Notifications
You must be signed in to change notification settings - Fork 216
Make XmlSerializer work with NativeAOT #593
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<linker> | ||
<type fullname="System.Xml.Serialization.XmlSerializer" featurevalue="true" feature="System.Xml.Serialization.XmlSerializer.IsReflectionOnly"> | ||
<method signature="System.Xml.Serialization.SerializationMode get_Mode()" body="stub" value="1" /> | ||
</type> | ||
</linker> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,12 @@ public XmlSerializer(Type type, string? defaultNamespace) | |
_primitiveType = type; | ||
return; | ||
} | ||
|
||
if (Mode == SerializationMode.ReflectionOnly) | ||
{ | ||
return; | ||
} | ||
|
||
_tempAssembly = s_cache[defaultNamespace, type]; | ||
if (_tempAssembly == null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Welp, I haven't done a full audit of what were all of the deleted ifdefs doing. This is more of an emergency fix to see what else the partner team is going to hit. We could file an issue to do a full audit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to also execute
GetTopLevelMapping
at the very bottom of the method in ReflectionOnly mode?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think this was all ifdeffed out:
https://github.com/dotnet/corefx/blob/e31a2b7f3bdf985f56798df530daa4c06fd80376/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs#L266-L308