Add tests for generic exception formatting

This commit is contained in:
Cédric Luthi
2025-02-05 18:20:12 +01:00
parent a6b96e9297
commit 7e1142df58
4 changed files with 30 additions and 0 deletions

View File

@ -6,6 +6,8 @@ public static class TestExceptions
public static bool GenericMethodThatThrows<T0, T1, TRet>(int? number) => throw new InvalidOperationException("Throwing!");
public static bool MethodThatThrowsGenericException<T>() => throw new GenericException<T>("Throwing!", default);
public static void ThrowWithInnerException()
{
try
@ -42,3 +44,6 @@ public static class TestExceptions
return ("key", new List<T>());
}
}
#pragma warning disable CS9113 // Parameter is unread.
public class GenericException<T>(string message, T value) : Exception(message);