Skip to content

Commit

Permalink
Nullable values types should be considered a match for null arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Jun 4, 2024
1 parent 3faaab2 commit 9b947e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions source/Halibut/Portability/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ public static bool IsValueType(this Type type)
{
return type.IsValueType;
}

public static bool IsNullable(this Type type)
{
return !type.IsValueType() || Nullable.GetUnderlyingType(type) != null;
}
}
}
2 changes: 1 addition & 1 deletion source/Halibut/ServiceModel/ServiceInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static MethodInfo SelectAsyncMethod(IList<MethodInfo> methods, RequestMessage re
{
var paramType = parameters[i].ParameterType;
var argType = argumentTypes[i];
if (argType == null && paramType.IsValueType())
if (argType == null && !paramType.IsNullable())
{
isMatch = false;
break;
Expand Down

0 comments on commit 9b947e4

Please sign in to comment.