I have the following scenario: Data lib in C# compiled as a Windows Runtime component.
One of its classes is looks like this:
public sealed class MyData
{
string TheGoods { get; private set;}
}
The UI is in WinJS, and I have the following:
var b = dataInstance.theGoods;
The problem is that I get an exception and property has the following in it:
System.ArgumentNullException at System.StubHelpers.HStringMarshaler.ConvertToNative(String managed)
Looking at the implementation of HStringMarshaler.ConvertToNative, it seems to throw if the string is null.
Does that mean that it's impossible to expose a null string to WinJS? Is that a WinJS limitation or does that apply to all WinRT?
While string.Empty does work, that's not semantically the same as null and in some cases, empty is valid and different than null.
If I change the type of the property to be 'object', then it does work, but it seems nasty to expose an object when it really ought to be a string. Any ideas? The docs are pretty light on this