Skip to content

Commit

Permalink
Fix remaining spots that Ref.Emit in XmlSerializer (dotnet#600)
Browse files Browse the repository at this point in the history
These were ifdeffed out for UAPAOT in the past. The rest of the UAPAOT ifdefs seem to be dealing with with the pregenerated serialization code that .NET Native creates and are not relevant for NativeAOT.
  • Loading branch information
MichalStrehovsky authored Jan 27, 2021
1 parent 0e6888d commit 1c0c677
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ public XmlSerializer(XmlTypeMapping xmlTypeMapping)
if (xmlTypeMapping == null)
throw new ArgumentNullException(nameof(xmlTypeMapping));

_tempAssembly = GenerateTempAssembly(xmlTypeMapping);
if (Mode != SerializationMode.ReflectionOnly)
{
_tempAssembly = GenerateTempAssembly(xmlTypeMapping);
}
_mapping = xmlTypeMapping;
}

Expand Down Expand Up @@ -256,7 +259,10 @@ public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraT
DefaultNamespace = defaultNamespace;
_rootType = type;
_mapping = GenerateXmlTypeMapping(type, overrides, extraTypes, root, defaultNamespace);
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location);
if (Mode != SerializationMode.ReflectionOnly)
{
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location);
}
}

private XmlTypeMapping GenerateXmlTypeMapping(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace)
Expand Down

0 comments on commit 1c0c677

Please sign in to comment.