Skip to content

Commit 9b947e4

Browse files
committed
Nullable values types should be considered a match for null arguments
1 parent 3faaab2 commit 9b947e4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

source/Halibut/Portability/TypeExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,10 @@ public static bool IsValueType(this Type type)
1717
{
1818
return type.IsValueType;
1919
}
20+
21+
public static bool IsNullable(this Type type)
22+
{
23+
return !type.IsValueType() || Nullable.GetUnderlyingType(type) != null;
24+
}
2025
}
2126
}

source/Halibut/ServiceModel/ServiceInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static MethodInfo SelectAsyncMethod(IList<MethodInfo> methods, RequestMessage re
6868
{
6969
var paramType = parameters[i].ParameterType;
7070
var argType = argumentTypes[i];
71-
if (argType == null && paramType.IsValueType())
71+
if (argType == null && !paramType.IsNullable())
7272
{
7373
isMatch = false;
7474
break;

0 commit comments

Comments
 (0)