diff --git a/PInvoke/Shared/WinError/Win32Error.cs b/PInvoke/Shared/WinError/Win32Error.cs
index 1f717155..3967c53f 100644
--- a/PInvoke/Shared/WinError/Win32Error.cs
+++ b/PInvoke/Shared/WinError/Win32Error.cs
@@ -104,8 +104,12 @@ namespace Vanara.PInvoke
/// The delegate which returns on failure.
/// The message.
/// The passed in on success.
- public static T ThrowLastErrorIf(T value, Func valueIsFailure, string message = null) =>
- !valueIsFailure(value) ? value : throw GetLastError().GetException(message);
+ public static T ThrowLastErrorIf(T value, Func valueIsFailure, string message = null)
+ {
+ if (valueIsFailure(value))
+ GetLastError().ThrowIfFailed(message);
+ return value;
+ }
/// Throws the last error if the function returns .
/// The value to check.