For whatever reason, the initialized value of a value struct
defined in Windows Runtime Component is ignored in the app (C#).
CX/C++:
namespace RuntimeComponent1
{
public value struct Foo {
bool flag1 = true;
bool flag2 = false;
};
}
C#
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
var settings = new RuntimeComponent1.Foo();
Debug.WriteLine(settings.flag1); // Output: False
Debug.WriteLine(settings.flag2); // Output: False
}
}
Notice that flag1
should be True
but instead it is False
. Why? !
Edit: As suggested by @HansPassant, create a ticket for this: https://connect.microsoft.com/VisualStudio/feedback/details/2702659 If you also think this is a problem. Please help up voting it.