diff --git a/BitFaster.Caching/Throw.cs b/BitFaster.Caching/Throw.cs index ef11a16e..d56ca5ec 100644 --- a/BitFaster.Caching/Throw.cs +++ b/BitFaster.Caching/Throw.cs @@ -7,17 +7,35 @@ namespace BitFaster.Caching { internal static class Throw { - public static void ArgNull(ExceptionArgument arg) => throw CreateArgumentNullException(arg); - - public static void ArgOutOfRange(string paramName) => throw CreateArgumentOutOfRangeException(paramName); - +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif + public static void ArgNull(ExceptionArgument arg) => throw CreateArgumentNullException(arg); + +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif + public static void ArgOutOfRange(string paramName) => throw CreateArgumentOutOfRangeException(paramName); + +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif public static void ArgOutOfRange(string paramName, string message) => throw CreateArgumentOutOfRangeException(paramName, message); [ExcludeFromCodeCoverage] - public static void InvalidOp(string message) => throw CreateInvalidOperationException(message); - +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif + public static void InvalidOp(string message) => throw CreateInvalidOperationException(message); + +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif public static void ScopedRetryFailure() => throw CreateScopedRetryFailure(); +#if NETCOREAPP3_0_OR_GREATER + [DoesNotReturn] +#endif public static void Disposed() => throw CreateObjectDisposedException(); [MethodImpl(MethodImplOptions.NoInlining)]