Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 653e57e

Browse files
committed
Merge pull request #1847 from dotnet-bot/from-tfs
Merge changes from TFS
2 parents 67bdb34 + 6382fd9 commit 653e57e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/System.Xml.XmlSerializer/src/System/Xml/Serialization/XmlSerializer.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ public XmlSerializer(Type type, string defaultNamespace)
155155
if (type == null)
156156
throw new ArgumentNullException("type");
157157

158+
#if NET_NATIVE
158159
// The ctor is not supported, but we cannot throw PNSE unconditionally
159160
// because the ctor is used by ctor(Type) which passes in a null defaultNamespace.
160161
if (!string.IsNullOrEmpty(defaultNamespace))
161162
{
162163
throw new PlatformNotSupportedException();
163164
}
164165

165-
#if NET_NATIVE
166166
rootType = type;
167167
#endif
168168
_mapping = GetKnownMapping(type, defaultNamespace);
@@ -210,7 +210,21 @@ public XmlSerializer(Type type, string defaultNamespace)
210210
/// </devdoc>
211211
internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, object location, object evidence)
212212
{
213+
#if NET_NATIVE
213214
throw new PlatformNotSupportedException();
215+
#else
216+
if (type == null)
217+
throw new ArgumentNullException("type");
218+
219+
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
220+
if (extraTypes != null)
221+
{
222+
for (int i = 0; i < extraTypes.Length; i++)
223+
importer.IncludeType(extraTypes[i]);
224+
}
225+
_mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
226+
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace);
227+
#endif
214228
}
215229

216230

src/System.Xml.XmlSerializer/tests/XmlSerializerTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,6 @@ public static void Xml_JaggedArrayAsRoot()
698698
}
699699

700700
[Fact]
701-
[ActiveIssue(1831)]
702701
public static void Xml_DefaultNamespaceChangeTest()
703702
{
704703
Assert.StrictEqual(
@@ -708,7 +707,6 @@ public static void Xml_DefaultNamespaceChangeTest()
708707
}
709708

710709
[Fact]
711-
[ActiveIssue(1831)]
712710
public static void Xml_KnownTypesThroughConstructor()
713711
{
714712
KnownTypesThroughConstructor value = new KnownTypesThroughConstructor() { EnumValue = MyEnum.One, SimpleTypeValue = new SimpleKnownTypeValue() { StrProperty = "PropertyValue" } };

0 commit comments

Comments
 (0)