Skip to content

Commit eea723b

Browse files
author
Hovsep Mkrtchyan
committed
Fixed CLU to account for nullable value types in parameters.
1 parent ef05a80 commit eea723b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/CLU/Microsoft.CLU/System.Management.Automation/ParameterMetadata.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ internal void InterpretAndSetValue(object instance, string argValue)
196196

197197
internal object InterpretValue(string strValue, Type argType)
198198
{
199+
if (strValue != null &&
200+
argType.GetTypeInfo().IsGenericType &&
201+
argType.GetGenericTypeDefinition() == typeof(Nullable<>))
202+
{
203+
return InterpretValue(strValue, argType.GetGenericArguments()[0]);
204+
}
205+
199206
if (!argType.GetTypeInfo().IsClass)
200207
{
201208
if (strValue == null) return null;

0 commit comments

Comments
 (0)