You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ISSUE:
When checking for the existence of a custom IError I sometimes get an exception that does not clearly point to the problem:
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.OfType[TResult](IEnumerable source)
at FluentResults.ResultHelper.HasError[TError](List1 errors, Func2 predicate, IEnumerable1& result) at FluentResults.ResultHelper.HasError[TError](List1 errors, Func2 predicate, IEnumerable1& result)
at FluentResults.ResultBase.HasError[TError](Func2 predicate, IEnumerable1& result)
at FluentResults.ResultBase.HasError[TError](IEnumerable`1& result)
at FluentResults.ResultBase.HasErrorTError
EXPECTED BEHAVIOR:
I would expect HasError<T> to return false instead of throwing.
CAUSE:
In my custom error I did not initialize Reasons in some cases.
SOLUTION:
I would recommend turning on <nullable>enable</nullable> to help flag null problems across the code base.
ISSUE:
When checking for the existence of a custom
IError
I sometimes get an exception that does not clearly point to the problem:EXPECTED BEHAVIOR:
I would expect
HasError<T>
to returnfalse
instead of throwing.CAUSE:
In my custom error I did not initialize
Reasons
in some cases.SOLUTION:
I would recommend turning on
<nullable>enable</nullable>
to help flag null problems across the code base.The problem seems to be in [public static bool HasError(](
FluentResults/src/FluentResults/Factories/ResultHelper.cs
Line 35 in 8b675de
where
predicate
is null when looking at a null set ofReasons
.Adding
is an example fix.
The text was updated successfully, but these errors were encountered: