Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@ -12,6 +12,7 @@ using System.Diagnostics;
using System.Reflection;
using NUnit.Framework;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
namespace MonoTests.System.Diagnostics
{
@ -181,7 +182,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (135,
Assert.AreEqual (136,
frame2.GetFileLineNumber (),
"Line number (2)");
@ -321,7 +322,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (271,
Assert.AreEqual (272,
frame2.GetFileLineNumber (),
"Line number (2)");
}
@ -377,6 +378,47 @@ namespace MonoTests.System.Diagnostics
}
}
[Test]
// https://github.com/mono/mono/issues/12688
public void GetFrames_AsynsCalls ()
{
StartAsyncCalls ().Wait ();
}
private async Task StartAsyncCalls ()
{
try
{
await AsyncMethod1 ();
}
catch (Exception exception)
{
var stackTrace = new StackTrace (exception, true);
Assert.AreEqual (25, stackTrace.GetFrames ().Length);
}
}
private async Task<int> AsyncMethod1 ()
{
return await AsyncMethod2 ();
}
private async Task<int> AsyncMethod2 ()
{
return await AsyncMethod3 ();
}
private async Task<int> AsyncMethod3 ()
{
return await AsyncMethod4 ();
}
private async Task<int> AsyncMethod4 ()
{
await Task.Delay (10);
throw new Exception ("Test exception thrown!");
}
/// <summary>
/// Tests whether getting method associated with frame works.
/// </summary>