diff options
author | Jiayi Yu <14067510+yujayee@users.noreply.github.com> | 2018-03-30 21:30:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-30 21:30:35 +0300 |
commit | 3d6e00c9be13dc047810d2ca877671b3bed6fd41 (patch) | |
tree | 60a2e01f5f655125dbda293178793aaad6b73327 /src/System.Private.Xml | |
parent | 1ad8ed9a7146f103a043de0ff8b8155246909dfa (diff) |
Fix MatchingRefApiCompat issues in Serialization libraries (#28552)
* Fixes: System.Xml.XmlSerializer/src/MatchingRefApiCompatBaseline.uap.txt
* fixes System.Xml.XmlSerializer/src/MatchingRefApiCompatBaseline.uapaot.txt
* Fixes: System.Xml.XmlSerializer/src/MatchingRefApiCompatBaseline.netcoreapp.txt
* Fixes: System.Runtime.Serialization.Xml/src/MatchingRefApiCompatBaseline.txt
* Bring back ReadString() as it is used somewhere else
* fix build errors
Diffstat (limited to 'src/System.Private.Xml')
4 files changed, 6 insertions, 53 deletions
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs b/src/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs index 88fc758431..5c81a051bd 100644 --- a/src/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs +++ b/src/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs @@ -693,7 +693,7 @@ namespace System.Xml.Serialization { if (special.TypeDesc.Kind == TypeKind.Node) { - value = Document.CreateTextNode(ReadString()); + value = Document.CreateTextNode(Reader.ReadString()); } else { @@ -706,11 +706,11 @@ namespace System.Xml.Serialization { if (text.Mapping.TypeDesc.CollapseWhitespace) { - value = CollapseWhitespace(ReadString()); + value = CollapseWhitespace(Reader.ReadString()); } else { - value = ReadString(); + value = Reader.ReadString(); } } else @@ -721,7 +721,7 @@ namespace System.Xml.Serialization } else { - value = WritePrimitive(text.Mapping, (state) => ((ReflectionXmlSerializationReader)state).ReadString(), this); + value = WritePrimitive(text.Mapping, (state) => ((ReflectionXmlSerializationReader)state).Reader.ReadString(), this); } } } @@ -1832,7 +1832,7 @@ namespace System.Xml.Serialization Func<object, string> functor = (state) => { var reader = (ReflectionXmlSerializationReader)state; - return reader.CollapseWhitespace(reader.ReadString()); + return reader.CollapseWhitespace(reader.Reader.ReadString()); }; o = WriteEnumMethod(enumMapping, functor, this); ReadEndElement(); diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSchemaImporter.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSchemaImporter.cs index 6d4dc7c57e..b3d3af2471 100644 --- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSchemaImporter.cs +++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSchemaImporter.cs @@ -37,19 +37,6 @@ namespace System.Xml.Serialization /// </devdoc> public XmlSchemaImporter(XmlSchemas schemas, CodeIdentifiers typeIdentifiers) : base(schemas, CodeGenerationOptions.GenerateProperties, new ImportContext(typeIdentifiers, false)) { } - /// <include file='doc\XmlSchemaImporter.uex' path='docs/doc[@for="XmlSchemaImporter.XmlSchemaImporter2"]/*' /> - /// <devdoc> - /// <para>[To be supplied.]</para> - /// </devdoc> - public XmlSchemaImporter(XmlSchemas schemas, CodeIdentifiers typeIdentifiers, CodeGenerationOptions options) : base(schemas, options, new ImportContext(typeIdentifiers, false)) { } - - /// <include file='doc\XmlSchemaImporter.uex' path='docs/doc[@for="XmlSchemaImporter.XmlSchemaImporter3"]/*' /> - /// <devdoc> - /// <para>[To be supplied.]</para> - /// </devdoc> - public XmlSchemaImporter(XmlSchemas schemas, CodeGenerationOptions options, ImportContext context) : base(schemas, options, context) { } - - /// <include file='doc\XmlSchemaImporter.uex' path='docs/doc[@for="XmlSchemaImporter.ImportDerivedTypeMapping"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs index 17a11a2cf5..3e349e4340 100644 --- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs +++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs @@ -1428,40 +1428,6 @@ namespace System.Xml.Serialization Array.Copy(a, b, length); return b; } - // This is copied from Core's XmlReader.ReadString, as it is not exposed in the Contract. - protected virtual string ReadString() - { - if (Reader.ReadState != ReadState.Interactive) - { - return string.Empty; - } - Reader.MoveToElement(); - if (Reader.NodeType == XmlNodeType.Element) - { - if (Reader.IsEmptyElement) - { - return string.Empty; - } - else if (!Reader.Read()) - { - throw new InvalidOperationException(SR.Xml_InvalidOperation); - } - if (Reader.NodeType == XmlNodeType.EndElement) - { - return string.Empty; - } - } - string result = string.Empty; - while (IsTextualNode(Reader.NodeType)) - { - result += Reader.Value; - if (!Reader.Read()) - { - break; - } - } - return result; - } // 0x6018 private static uint s_isTextualNodeBitmap = (1 << (int)XmlNodeType.Text) | (1 << (int)XmlNodeType.CDATA) | (1 << (int)XmlNodeType.Whitespace) | (1 << (int)XmlNodeType.SignificantWhitespace); diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs index 25fdb4df57..d9f998ba0f 100644 --- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs +++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs @@ -807,7 +807,7 @@ namespace System.Xml.Serialization #if !FEATURE_SERIALIZATION_UAPAOT [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] [ResourceExposure(ResourceScope.None)] - public static bool GenerateSerializer(Type[] types, XmlMapping[] mappings, Stream stream) + internal static bool GenerateSerializer(Type[] types, XmlMapping[] mappings, Stream stream) { if (types == null || types.Length == 0) return false; |