提交 6c91fec4 编写于 作者: S Shin Mao 提交者: GitHub

Fix XmlSchemaTest in ReflectionOnly mode. (dotnet/corefx#14596)

* Fix XmlSchemaTest in ReflectionOnly mode.

Fix dotnet/corefx#11918

* Adress feedback.


Commit migrated from https://github.com/dotnet/corefx/commit/5b4c955cf446cc735a45353d46261d5a6823a2fe
上级 6018b476
......@@ -387,7 +387,7 @@ private void WriteElement(object o, ElementAccessor element, string arrayName, b
throw new PlatformNotSupportedException();
}
WriteStructMethod(mapping, name, ns, o, mapping.TypeDesc.IsNullable, needType: false, parentMapping: parentMapping);
WriteStructMethod(mapping, name, ns, o, element.IsNullable, needType: false, parentMapping: parentMapping);
}
else if (element.Mapping is SpecialMapping)
{
......@@ -477,7 +477,7 @@ private void WriteStructMethod(StructMapping mapping, string n, string ns, objec
{
if (mapping.TypeDesc.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.TypeDesc.Type))
{
throw new PlatformNotSupportedException(typeof(XmlSchemaObject).ToString());
EscapeName = false;
}
XmlSerializerNamespaces xmlnsSource = null;
......@@ -711,12 +711,10 @@ private void WriteMember(object memberValue, AttributeAccessor attribute, TypeDe
}
}
var a = memberValue as IEnumerable;
// #10593: Add More Tests for Serialization Code
Debug.Assert(a != null);
var e = a.GetEnumerator();
if (memberValue != null)
{
var a = (IEnumerable) memberValue;
IEnumerator e = a.GetEnumerator();
bool shouldAppendWhitespace = false;
if (e != null)
{
......@@ -793,6 +791,7 @@ private void WriteMember(object memberValue, AttributeAccessor attribute, TypeDe
}
}
}
}
else
{
WriteAttribute(memberValue, attribute, parent);
......
......@@ -2331,9 +2331,6 @@ public static void XML_TypeWithFieldsOrdered()
Assert.Equal(value.StringField2, actual.StringField2);
}
#if ReflectionOnly
[ActiveIssue(14260)]
#endif
[Fact]
public static void XmlSchemaTest()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册