Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -1,3 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Reliability", "CA2002:DoNotLockOnObjectsWithWeakIdentity", Scope = "member", Target = "System.Diagnostics.TraceInternal.#Flush()")]

View File

@@ -56,7 +56,7 @@ namespace System.Diagnostics
{
if (s_appName == null)
{
s_appName = Assembly.GetEntryAssembly().GetName().Name;
s_appName = Assembly.GetEntryAssembly()?.GetName().Name ?? string.Empty;
}
return s_appName;
}

View File

@@ -354,7 +354,16 @@ namespace System.Diagnostics.TraceSourceTests
[Fact]
public void TraceTest02()
{
String newLine = Environment.NewLine;
var textTL = new TestTextTraceListener();
Trace.Listeners.Clear();
Trace.Listeners.Add(textTL);
Trace.IndentLevel = 0;
Trace.Fail("");
textTL.Flush();
var fail = textTL.Output.TrimEnd(newLine.ToCharArray());
textTL = new TestTextTraceListener();
// We have to clear the listeners list on Trace since there is a trace listener by default with AssertUiEnabled = true in Desktop and that will pop up an assert window with Trace.Fail
Trace.Listeners.Clear();
Trace.Listeners.Add(textTL);
@@ -377,8 +386,8 @@ namespace System.Diagnostics.TraceSourceTests
Trace.Unindent();
Trace.WriteLine("Message end.");
textTL.Flush();
String newLine = Environment.NewLine;
var expected = "Message start." + newLine + " This message should be indented.This should not be indented." + newLine + " Fail: This failure is reported with a detailed message" + newLine + " Fail: " + newLine + " Fail: This assert is reported" + newLine + "Message end." + newLine;
newLine = Environment.NewLine;
var expected = "Message start." + newLine + " This message should be indented.This should not be indented." + newLine + " " + fail + "This failure is reported with a detailed message" + newLine + " " + fail + newLine + " " + fail + "This assert is reported" + newLine + "Message end." + newLine;
Assert.Equal(expected, textTL.Output);
}
}

View File

@@ -60,7 +60,7 @@ namespace System.Diagnostics.TraceSourceTests
public void CallstackTest_ContainsExpectedFrames()
{
var cache = new TraceEventCache();
Assert.Contains("at System.Environment.get_StackTrace()", cache.Callstack);
Assert.Contains("System.Environment.get_StackTrace()", cache.Callstack);
}
[Fact]