Hi ifle,
Well, not quite, because that description applies to .NET strings :)
That doesn't seem completely correct either. A value type
Here's what we've found in our testing:
Thanks again for your input!
Only host members with strongly typed objects that derive from the Object class with specific reference type can return DispatchWrapper(null) in case of null.
Well, not quite, because that description applies to .NET strings :)
Host members like string, object, nullable<T> should return DBNull.
That doesn't seem completely correct either. A value type
T
that isn't numeric or boolean turns into an object reference on the script side, so a Nullable<T>
without a value should probably be marshalled as nothing
. And object
is completely ambiguous; ideal null marshaling in that case depends entirely on what the script expects.
I'm not sure about DBNull, because .NET marshal a null value as VT_EMPTY and not as VT_NULL like DBNull
Here's what we've found in our testing:
DBNull.Value
appears asnull
in both JScript and VBScript.null
appears asundefined
in JScript andempty
in VBScript.new DispatchWrapper(null)
appears asundefined
in JScript andnothing
in VBScript.
null
appears as null
on the script side. In any case, we agree that (at least) strings, nullable booleans, and nullable numerics should override MarshalNullAsDispatch
, and we'll make that fix ASAP.Thanks again for your input!