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

@@ -484,7 +484,7 @@ namespace System.Runtime.Diagnostics
{
OnShutdownTracing();
}
#pragma warning suppress 56500 //[....]; Taken care of by FxCop
#pragma warning suppress 56500 //Microsoft; Taken care of by FxCop
catch (Exception exception)
{
if (Fx.IsFatal(exception))

View File

@@ -15,6 +15,7 @@ namespace System.Runtime.Diagnostics
using System.Xml.XPath;
using System.Diagnostics.CodeAnalysis;
using System.Security.Permissions;
using System.ServiceModel.Internals;
using System.Collections.Generic;
using System.Collections.Concurrent;
@@ -29,6 +30,7 @@ namespace System.Runtime.Diagnostics
const string DiagnosticTraceSource = "System.ServiceModel.Diagnostics";
const int XmlBracketsLength = 5; // "<></>".Length;
const int XmlBracketsLengthForNullValue = 4; // "< />".Length; (Empty XML Element)
static readonly public Guid ImmutableDefaultEtwProviderId = new Guid("{c651f5f6-1c0d-492e-8ae1-b4efd7c9d503}");
[Fx.Tag.SecurityNote(Critical = "provider Id to create EtwProvider, which is SecurityCritical")]
@@ -891,7 +893,19 @@ namespace System.Runtime.Diagnostics
static bool WriteXmlElementString(XmlTextWriter xml, string localName, string value, ref int remainingLength)
{
int xmlElementLength = (localName.Length * 2) + EtwDiagnosticTrace.XmlBracketsLength + value.Length;
int xmlElementLength;
// Quirk to fix DevDiv 155469: All previous versions of that platform (up-to 4.6.2) will get the old behavior (throw null ref when Exception Message property is null)
if (string.IsNullOrEmpty(value) && !LocalAppContextSwitches.IncludeNullExceptionMessageInETWTrace)
{
xmlElementLength = localName.Length + EtwDiagnosticTrace.XmlBracketsLengthForNullValue;
}
else
{
xmlElementLength = (localName.Length * 2) + EtwDiagnosticTrace.XmlBracketsLength + value.Length;
}
if (xmlElementLength <= remainingLength)
{
xml.WriteElementString(localName, value);