Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/libraries/System.Runtime/tests/System/ExceptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static void Exception_GetBaseException()
}

[Fact]
public static void Exception_TargetSite_Jit()
public static void Exception_TargetSite()
{
bool caught = false;

Expand All @@ -78,6 +78,32 @@ public static void Exception_TargetSite_Jit()

Assert.True(caught);
}

static void RethrowException()
{
try
{
ThrowException();
}
catch
{
throw;
}
}

[Fact]
public static void Exception_TargetSite_OtherMethod()
{
Exception ex = Assert.ThrowsAny<Exception>(() => ThrowException());
Assert.Equal(nameof(ThrowException), ex.TargetSite.Name);
}

[Fact]
public static void Exception_TargetSite_Rethrow()
{
Exception ex = Assert.ThrowsAny<Exception>(() => RethrowException());
Assert.Equal(nameof(ThrowException), ex.TargetSite.Name);
}

[Fact]
[ActiveIssue("https://github.com/mono/mono/issues/15140", TestRuntimes.Mono)]
Expand Down