Skip to content

Commit

Permalink
Adapt for corrected nullability annotation
Browse files Browse the repository at this point in the history
The return value of `implicit operator string(StringValues values)` has changed to nullable in .NET 8. However the implementation did not change. So adapt our code to use `ToString()` instead, which never returns null.
  • Loading branch information
bkoelman committed Jul 23, 2023
1 parent 1535b64 commit f6e2616
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public virtual void Read(string parameterName, StringValues parameterValue)
}
catch (QueryParseException exception)
{
string specificMessage = exception.GetMessageWithPosition(parameterValue);
string specificMessage = exception.GetMessageWithPosition(parameterValue.ToString());
throw new InvalidQueryStringParameterException(parameterName, "The specified include is invalid.", specificMessage, exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public virtual void Read(string parameterName, StringValues parameterValue)
}
catch (QueryParseException exception)
{
string specificMessage = exception.GetMessageWithPosition(isParameterNameValid ? parameterValue : parameterName);
string specificMessage = exception.GetMessageWithPosition(isParameterNameValid ? parameterValue.ToString() : parameterName);
throw new InvalidQueryStringParameterException(parameterName, "The specified pagination is invalid.", specificMessage, exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public virtual void Read(string parameterName, StringValues parameterValue)
}
catch (QueryParseException exception)
{
string specificMessage = exception.GetMessageWithPosition(parameterNameIsValid ? parameterValue : parameterName);
string specificMessage = exception.GetMessageWithPosition(parameterNameIsValid ? parameterValue.ToString() : parameterName);
throw new InvalidQueryStringParameterException(parameterName, "The specified sort is invalid.", specificMessage, exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public virtual void Read(string parameterName, StringValues parameterValue)
}
catch (QueryParseException exception)
{
string specificMessage = exception.GetMessageWithPosition(parameterNameIsValid ? parameterValue : parameterName);
string specificMessage = exception.GetMessageWithPosition(parameterNameIsValid ? parameterValue.ToString() : parameterName);
throw new InvalidQueryStringParameterException(parameterName, "The specified fieldset is invalid.", specificMessage, exception);
}
}
Expand Down

0 comments on commit f6e2616

Please sign in to comment.