diff --git a/src/Core/Types/Utilities/TypeConversion.cs b/src/Core/Types/Utilities/TypeConversion.cs index 1c3bc169376..c0ccb5fc38f 100644 --- a/src/Core/Types/Utilities/TypeConversion.cs +++ b/src/Core/Types/Utilities/TypeConversion.cs @@ -61,12 +61,20 @@ public object Convert(Type from, Type to, object source) throw new ArgumentNullException(nameof(to)); } - if (source is null || from == to) + if (from == to) { converted = source; return true; } + if (source is null) + { + converted = to.IsValueType + ? Activator.CreateInstance(to) + : null; + return true; + } + try { Type fromInternal = (from == typeof(object) && source != null)