Skip to content
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

Make XmlSerializer work with NativeAOT #593

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

MichalStrehovsky
Copy link
Member

Force the reflection-only code paths that don't Reflection.Emit.

Force the reflection-only code paths that don't Reflection.Emit.
@MichalStrehovsky MichalStrehovsky added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Jan 26, 2021

if (Mode == SerializationMode.ReflectionOnly)
{
return;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
return;
}

_tempAssembly = s_cache[defaultNamespace, type];
if (_tempAssembly == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fix XmlSerializer(XmlTypeMapping xmlTypeMapping) constructor in the same way?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichalStrehovsky MichalStrehovsky merged commit 36d6b3a into dotnet:feature/NativeAOT Jan 26, 2021
@MichalStrehovsky MichalStrehovsky deleted the xmlSer branch January 26, 2021 18:34
eerhardt added a commit to eerhardt/runtime that referenced this pull request Sep 21, 2021
Add more checks to XmlSerializer to check the SerializationMode. Don't try to use Reflection.Emit if the SerializationMode is ReflectionOnly.

These changes were ported from
* dotnet/runtimelab#593
* dotnet/runtimelab#600

Fix dotnet#59167
eerhardt added a commit to dotnet/runtime that referenced this pull request Sep 23, 2021
* XmlSerializer support for IsDynamicCodeSupported=false

Add more checks to XmlSerializer to check the SerializationMode. Don't try to use Reflection.Emit if the SerializationMode is ReflectionOnly.

These changes were ported from
* dotnet/runtimelab#593
* dotnet/runtimelab#600

Fix #59167

* Fix a bug in XmlSerializer.CanDeserialize when in ReflectionOnly mode.

* Port UAP code for CanDeserialize

* PR feedback

* Add a linker test to ensure linker option '--enable-opt sealer' works when IsDynamicCodeSupported==false.
github-actions bot pushed a commit to dotnet/runtime that referenced this pull request Sep 23, 2021
Add more checks to XmlSerializer to check the SerializationMode. Don't try to use Reflection.Emit if the SerializationMode is ReflectionOnly.

These changes were ported from
* dotnet/runtimelab#593
* dotnet/runtimelab#600

Fix #59167
Anipik pushed a commit to dotnet/runtime that referenced this pull request Sep 24, 2021
…lse (#59507)

* XmlSerializer support for IsDynamicCodeSupported=false

Add more checks to XmlSerializer to check the SerializationMode. Don't try to use Reflection.Emit if the SerializationMode is ReflectionOnly.

These changes were ported from
* dotnet/runtimelab#593
* dotnet/runtimelab#600

Fix #59167

* Fix a bug in XmlSerializer.CanDeserialize when in ReflectionOnly mode.

* Port UAP code for CanDeserialize

* PR feedback

* Add a linker test to ensure linker option '--enable-opt sealer' works when IsDynamicCodeSupported==false.

Co-authored-by: Eric Erhardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants