Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • 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.
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
{
}
}

0 comments on commit 2f0ba6d

Please sign in to comment.