Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -164,6 +164,7 @@ XmlInvalidConversion=The value '{0}' cannot be parsed as the type '{1}'.
XmlInvalidConversionWithoutValue=The value cannot be parsed as the type '{0}'.
XmlStartElementExpected=Start element expected. Found {0}.
XmlWriterMustBeInElement=WriteState '{0}' not valid. Caller must write start element before serializing in contentOnly mode.
NonOptionalFieldMemberOnIsReferenceSerializableType={0}.{1}' is not marked with OptionalFieldAttribute, thus indicating that it must be serialized. However, '{0}' derives from a class marked with DataContractAttribute and an IsReference setting of '{2}'. It is not possible to have required data members on IsReference classes. Either decorate '{0}.{1}' with OptionalFieldAttribute, or disable the IsReference setting on the appropriate parent class.
# System.Text
@ -188,25 +189,25 @@ InvalidLocalNameEmpty=The empty string is not a valid local name.
;QuotaMustBePositive=Quota must be a positive value.
XmlArrayTooSmall=Array too small.
XmlArrayTooSmallInput=Array too small. Length of available data must be at least {0}.
;XmlBadBOM=Unrecognized Byte Order Mark.
XmlBadBOM=Unrecognized Byte Order Mark.
XmlBase64DataExpected=Base64 encoded data expected. Found {0}.
;XmlCDATAInvalidAtTopLevel=CData elements not valid at top level of an XML document.
;XmlCloseCData=']]>' not valid in text node content.
XmlCDATAInvalidAtTopLevel=CData elements not valid at top level of an XML document.
XmlCloseCData=']]>' not valid in text node content.
XmlConversionOverflow=The value '{0}' cannot be represented with the type '{1}'.
;XmlDeclarationRequired=An XML declaration with an encoding is required for all non-UTF8 documents.
XmlDeclarationRequired=An XML declaration with an encoding is required for all non-UTF8 documents.
XmlDeclMissingVersion=Version not found in XML declaration.
;XmlDeclMissing=An XML declaration is required for all non-UTF8 documents.
;XmlDeclNotFirst=No characters can appear before the XML declaration.
XmlDeclMissing=An XML declaration is required for all non-UTF8 documents.
XmlDeclNotFirst=No characters can appear before the XML declaration.
XmlDictionaryStringIDRange=XmlDictionaryString IDs must be in the range from {0} to {1}.
XmlDictionaryStringIDUndefinedSession=XmlDictionaryString ID {0} not defined in the XmlBinaryReaderSession.
XmlDictionaryStringIDUndefinedStatic=XmlDictionaryString ID {0} not defined in the static dictionary.
XmlDuplicateAttribute=Duplicate attribute found. Both '{0}' and '{1}' are from the namespace '{2}'.
XmlEmptyNamespaceRequiresNullPrefix=The empty namespace requires a null or empty prefix.
;XmlEncodingMismatch=The encoding in the declaration '{0}' does not match the encoding of the document '{1}'.
;XmlEncodingNotSupported=XML encoding not supported.
XmlEncodingMismatch=The encoding in the declaration '{0}' does not match the encoding of the document '{1}'.
XmlEncodingNotSupported=XML encoding not supported.
XmlEndElementExpected=End element '{0}' from namespace '{1}' expected. Found {2}.
XmlEndElementNoOpenNodes=No corresponding start element is open.
;XmlExpectedEncoding=The expected encoding '{0}' does not match the actual encoding '{1}'.
XmlExpectedEncoding=The expected encoding '{0}' does not match the actual encoding '{1}'.
XmlFoundCData=cdata '{0}'
XmlFoundComment=comment '{0}'
XmlFoundElement=element '{0}' from namespace '{1}'
@ -220,31 +221,31 @@ XmlFullStartElementNameExpected=Non-empty start element '{0}' expected. Found {1
XmlIDDefined=ID already defined.
XmlKeyAlreadyExists=The specified key already exists in the dictionary.
XmlIllegalOutsideRoot=Text cannot be written outside the root element.
;XmlInvalidBytes=Invalid byte encoding.
XmlInvalidBytes=Invalid byte encoding.
XmlInvalidCharRef=Character reference not valid.
XmlInvalidCommentChars=XML comments cannot contain '--' or end with '-'.
XmlInvalidDeclaration=XML declaration can only be written at the beginning of the document.
XmlInvalidDepth=Cannot call '{0}' while Depth is '{1}'.
XmlInvalidEncoding=XML encoding must be 'UTF-8'.
;XmlInvalidFFFE=Characters with hexadecimal values 0xFFFE and 0xFFFF are not valid.
XmlInvalidFFFE=Characters with hexadecimal values 0xFFFE and 0xFFFF are not valid.
XmlInvalidFormat=The input source is not correctly formatted.
XmlInvalidID=ID must be >= 0.
XmlInvalidOperation=The reader cannot be advanced.
XmlInvalidPrefixState=A prefix cannot be defined while WriteState is '{0}'.
XmlInvalidQualifiedName=Expected XML qualified name. Found '{0}'.
;XmlInvalidRootData=The data at the root level is invalid.
XmlInvalidRootData=The data at the root level is invalid.
XmlInvalidStandalone='standalone' value in declaration must be 'yes' or 'no'.
;XmlInvalidStream=Stream returned by IStreamProvider cannot be null.
XmlInvalidUniqueId=UniqueId cannot be zero length.
XmlInvalidUTF8Bytes='{0}' contains invalid UTF8 bytes.
XmlInvalidVersion=XML version must be '1.0'.
XmlInvalidWriteState='{0}' cannot be called while WriteState is '{1}'.
;XmlInvalidXmlByte=The byte 0x{0} is not valid at this location.
XmlInvalidXmlByte=The byte 0x{0} is not valid at this location.
XmlInvalidXmlSpace='{0}' is not a valid xml:space value. Valid values are 'default' and 'preserve'.
XmlLineInfo=Line {0}, position {1}.
XmlMalformedDecl=Malformed XML declaration.
XmlMaxArrayLengthExceeded=The maximum array length quota ({0}) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
#XmlMaxBytesPerReadExceeded=The 'maximum bytes per Read operation' quota ({0}) has been exceeded while reading XML data. Long element start tags (consisting of the element name, attribute names and attribute values) may trigger this quota. This quota may be increased by changing the MaxBytesPerRead property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
XmlMaxBytesPerReadExceeded=The 'maximum bytes per Read operation' quota ({0}) has been exceeded while reading XML data. Long element start tags (consisting of the element name, attribute names and attribute values) may trigger this quota. This quota may be increased by changing the MaxBytesPerRead property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
#XmlMaxDepthExceeded=The maximum read depth ({0}) has been exceeded because XML data being read has more levels of nesting than is allowed by the quota. This quota may be increased by changing the MaxDepth property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
XmlMaxNameTableCharCountExceeded=The maximum nametable character count quota ({0}) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
#XmlMaxStringContentLengthExceeded=The maximum string content length quota ({0}) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
@ -260,13 +261,13 @@ XmlOnlySingleValue=Only a single typed value may be written inside an attribute
XmlPrefixBoundToNamespace=The prefix '{0}' is bound to the namespace '{1}' and cannot be changed to '{2}'.
XmlProcessingInstructionNotSupported=Processing instructions (other than the XML declaration) and DTDs are not supported.
XmlReservedPrefix=Prefixes beginning with "xml" (regardless of casing) are reserved for use by XML.
;XmlSpaceBetweenAttributes=Whitespace must appear between attributes.
XmlSpaceBetweenAttributes=Whitespace must appear between attributes.
XmlSpecificBindingNamespace=The namespace '{1}' can only be bound to the prefix '{0}'.
XmlSpecificBindingPrefix=The prefix '{0}' can only be bound to the namespace '{1}'.
XmlStartElementLocalNameNsExpected=Start element '{0}' from namespace '{1}' expected. Found {2}.
XmlStartElementNameExpected=Start element '{0}' expected. Found {1}.
;XmlTagMismatch=Start element '{0}' does not match end element '{1}'.
;XmlTokenExpected=The token '{0}' was expected but found '{1}'.
XmlTagMismatch=Start element '{0}' does not match end element '{1}'.
XmlTokenExpected=The token '{0}' was expected but found '{1}'.
XmlUndefinedPrefix=The prefix '{0}' is not defined.
XmlUnexpectedEndElement=No matching start tag for end element.
XmlUnexpectedEndOfFile=Unexpected end of file. Following elements are not closed: {0}.

View File

@ -13,7 +13,7 @@ namespace System.Runtime.Serialization.Configuration
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("config");
}
#pragma warning suppress 56506 // [....], config is checked above
#pragma warning suppress 56506 // Microsoft, config is checked above
return (SerializationSectionGroup)config.SectionGroups[ConfigurationStrings.SectionGroupName];
}

View File

@ -16,7 +16,7 @@ namespace System.Runtime.Serialization.Json
// This wrapper does not support seek.
// Supports: UTF-8, Unicode, BigEndianUnicode
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
class JsonEncodingStreamWrapper : Stream
{
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - Static fields are marked SecurityCritical or readonly to prevent"

View File

@ -27,6 +27,9 @@ namespace System.Runtime.Serialization.Json
const char WHITESPACE = ' ';
const char CARRIAGE_RETURN = '\r';
const char NEWLINE = '\n';
const char BACKSPACE = '\b';
const char FORM_FEED = '\f';
const char HORIZONTAL_TABULATION = '\t';
const string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
const string xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
@ -34,6 +37,9 @@ namespace System.Runtime.Serialization.Json
+ " data from being modified or leaked to other components in appdomain.")]
[SecurityCritical]
static BinHexEncoding binHexEncoding;
// This array was part of a perf improvement for escaping characters < WHITESPACE.
static char[] CharacterAbbrevs;
string attributeText;
JsonDataType dataType;
@ -71,6 +77,57 @@ namespace System.Runtime.Serialization.Json
this.indentChars = indentChars;
}
InitializeWriter();
if (CharacterAbbrevs == null)
{
CharacterAbbrevs = GetCharacterAbbrevs();
}
}
private static char[] GetCharacterAbbrevs()
{
var abbrevs = new char[WHITESPACE];
for(int i = 0; i < WHITESPACE; i++)
{
char abbrev;
if (!LocalAppContextSwitches.DoNotUseEcmaScriptV6EscapeControlCharacter && TryEscapeControlCharacter((char)i, out abbrev))
{
abbrevs[i] = abbrev;
}
else
{
abbrevs[i] = (char) 0;
}
}
return abbrevs;
}
private static bool TryEscapeControlCharacter(char ch, out char abbrev)
{
switch (ch)
{
case BACKSPACE:
abbrev = 'b';
break;
case HORIZONTAL_TABULATION:
abbrev = 't';
break;
case NEWLINE:
abbrev = 'n';
break;
case FORM_FEED:
abbrev = 'f';
break;
case CARRIAGE_RETURN:
abbrev = 'r';
break;
default:
abbrev = ' ';
return false;
}
return true;
}
enum JsonDataType
@ -794,7 +851,7 @@ namespace System.Runtime.Serialization.Json
WriteString(new string(buffer, index, count));
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // [....], ToLowerInvariant is just used in Json error message
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // Microsoft, ToLowerInvariant is just used in Json error message
public override void WriteStartAttribute(string prefix, string localName, string ns)
{
if (IsClosed)
@ -1376,7 +1433,7 @@ namespace System.Runtime.Serialization.Json
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // [....], ToLowerInvariant is just used in Json error message
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // Microsoft, ToLowerInvariant is just used in Json error message
void ThrowInvalidAttributeContent()
{
if (HasOpenAttribute)
@ -1450,7 +1507,7 @@ namespace System.Runtime.Serialization.Json
{
char ch = chars[j];
if (ch <= FORWARD_SLASH)
{
{
if (ch == FORWARD_SLASH || ch == JsonGlobals.QuoteChar)
{
nodeWriter.WriteChars(chars + i, j - i);
@ -1462,9 +1519,17 @@ namespace System.Runtime.Serialization.Json
{
nodeWriter.WriteChars(chars + i, j - i);
nodeWriter.WriteText(BACK_SLASH);
nodeWriter.WriteText('u');
nodeWriter.WriteText(string.Format(CultureInfo.InvariantCulture, "{0:x4}", (int)ch));
i = j + 1;
if (CharacterAbbrevs[ch] == 0)
{
nodeWriter.WriteText('u');
nodeWriter.WriteText(string.Format(CultureInfo.InvariantCulture, "{0:x4}", (int)ch));
i = j + 1;
}
else
{
nodeWriter.WriteText(CharacterAbbrevs[ch]);
i = j + 1;
}
}
}
else if (ch == BACK_SLASH)

View File

@ -11,9 +11,9 @@ namespace System.Xml
// This wrapper does not support seek.
// Constructors consume/emit byte order mark.
// Supports: UTF-8, Unicode, BigEndianUnicode
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
// ASSUMPTION ([....]): The byte buffer is large enough to hold the declaration
// ASSUMPTION ([....]): The buffer manipulation methods (FillBuffer/Compare/etc.) will only be used to parse the declaration
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
// ASSUMPTION (Microsoft): The byte buffer is large enough to hold the declaration
// ASSUMPTION (Microsoft): The buffer manipulation methods (FillBuffer/Compare/etc.) will only be used to parse the declaration
// during construction.
class EncodingStreamWrapper : Stream
{
@ -749,7 +749,7 @@ namespace System.Xml
// Add format exceptions
// Do we need to modify the stream position/Seek to account for the buffer?
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing.
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing.
#if NO
class UTF16Stream : Stream
{

View File

@ -352,7 +352,7 @@ namespace System.Xml
if (object.ReferenceEquals(id1, null) || object.ReferenceEquals(id2, null))
return false;
#pragma warning suppress 56506 // [....], checks for whether id1 and id2 are null done above.
#pragma warning suppress 56506 // Microsoft, checks for whether id1 and id2 are null done above.
if (id1.IsGuid && id2.IsGuid)
{
return id1.idLow == id2.idLow && id1.idHigh == id2.idHigh;

View File

@ -539,7 +539,7 @@ namespace System.Xml
}
}
// ASSUMPTION ([....]): all chars in str will be ASCII
// ASSUMPTION (Microsoft): all chars in str will be ASCII
public bool Equals2(string str, bool checkLower)
{
if (this.type != ValueHandleType.UTF8)

View File

@ -1 +1 @@
008ed195fb5be846e544d683f6ae95ec2f25c1fe
f92e4af7485d831932c37d65ed819620bfd40c4f

View File

@ -1,9 +1,9 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
// PERF, [....], [....]: Make LookupNamespace do something smarter when lots of names
// PERF, [....], [....]: Make Attribute lookup smarter when lots of attributes
// PERF: [....], [....]: Compare safe/unsafe versions
// PERF, Microsoft, Microsoft: Make LookupNamespace do something smarter when lots of names
// PERF, Microsoft, Microsoft: Make Attribute lookup smarter when lots of attributes
// PERF: Microsoft, Microsoft: Compare safe/unsafe versions
namespace System.Xml
{

View File

@ -145,7 +145,7 @@ namespace System.Xml
{
if (LookupPrefix(namespaceUri) != null)
return;
#pragma warning suppress 56506 // [....], namespaceUri is already checked
#pragma warning suppress 56506 // Microsoft, namespaceUri is already checked
prefix = namespaceUri.Length == 0 ? string.Empty : string.Concat("d", namespaceUri.Length.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
}
WriteAttributeString("xmlns", prefix, null, namespaceUri);
@ -196,7 +196,7 @@ namespace System.Xml
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("localName"));
if (namespaceUri == null)
namespaceUri = XmlDictionaryString.Empty;
#pragma warning suppress 56506 // [....], XmlDictionaryString.Empty is never null
#pragma warning suppress 56506 // Microsoft, XmlDictionaryString.Empty is never null
WriteQualifiedName(localName.Value, namespaceUri.Value);
}
@ -301,7 +301,7 @@ namespace System.Xml
{
if (completionException == null)
{
// only release stream when no exception (mirrors [....] behaviour)
// only release stream when no exception (mirrors sync behaviour)
this.streamProvider.ReleaseStream(this.stream);
this.stream = null;
}
@ -311,7 +311,7 @@ namespace System.Xml
void ContinueWork(bool completedSynchronously, Exception completionException = null)
{
// Individual Reads or writes may complete [....] or async. A callback however
// Individual Reads or writes may complete sync or async. A callback however
// will always all ContinueWork() with CompletedSynchronously=false this flag
// is used to complete this AsyncResult.
try
@ -565,7 +565,7 @@ namespace System.Xml
{
if (completionException == null)
{
// only release stream when no exception (mirrors [....] behaviour)
// only release stream when no exception (mirrors sync behaviour)
this.streamProvider.ReleaseStream(this.stream);
this.stream = null;
}
@ -582,7 +582,7 @@ namespace System.Xml
{
if (HandleReadBlock(result))
{
// Read completed ([....] or async, doesn't matter)
// Read completed (sync or async, doesn't matter)
if (this.bytesRead > 0)
{
// allow loop to continue at Write
@ -604,7 +604,7 @@ namespace System.Xml
{
if (this.writeBlockHandler(result, this))
{
// Write completed ([....] or async, doesn't matter)
// Write completed (sync or async, doesn't matter)
AdjustBlockSize();
operation = Operation.Read;
}

View File

@ -1 +1 @@
69831c0d846ab89693ca98cffb0788052c2229ac
1c5fd2c4cfdbe3342d1edbde3ae67caf041added