-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateo Torres Ruiz
committed
Oct 14, 2021
1 parent
fdcc634
commit 2f0ba6d
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/coreclr/tools/ILTrim/ILTrim.Tests.Cases/Basic/ExceptionRegions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
|
||
namespace Mono.Linker.Tests.Cases.Basic | ||
{ | ||
[Kept] | ||
public class ExceptionRegions | ||
{ | ||
[Kept] | ||
static void Main() | ||
{ | ||
try | ||
{ | ||
A(); | ||
} | ||
catch (CustomException ce) | ||
{ | ||
Console.WriteLine(ce.Message); | ||
try | ||
{ | ||
B(); | ||
} | ||
catch (Exception e) when (e.InnerException != null) | ||
{ | ||
Console.WriteLine(e.Message); | ||
} | ||
} | ||
finally | ||
{ | ||
C(); | ||
} | ||
} | ||
|
||
[Kept] | ||
static void A() { } | ||
|
||
[Kept] | ||
static void B() { } | ||
|
||
[Kept] | ||
static void C() { } | ||
} | ||
|
||
[Kept] | ||
[KeptBaseType(typeof(Exception))] | ||
class CustomException : Exception | ||
{ | ||
} | ||
} |