diff --git a/Perspex/Contract.cs b/Perspex/Contract.cs index 82edb5af63..1550c098dd 100644 --- a/Perspex/Contract.cs +++ b/Perspex/Contract.cs @@ -8,8 +8,14 @@ namespace Perspex { internal static class Contract { - public static void Requires(bool condition) where TException : Exception + public static void Requires(bool condition) where TException : Exception, new() { +#if DEBUG + if (!condition) + { + throw new TException(); + } +#endif } } }