In Windows Phone 8 (only on device!) try running this code:
public MainPage()
{
InitializeComponent();
var myTrue = GetTrue();
Debug.WriteLine(myTrue);
// false
}
[MethodImpl(MethodImplOptions.Synchronized)]
private static bool? GetTrue()
{
return true;
}
You will see myTrue
always is False! Why?! How it can be?!
UPDATE: Tested on devices: Nokia Lumia 920, HTC 8X, Nokia Lumia 925
I think that kind of behavior is due to this:
Windows Phone
Specifying the Synchronized option for the MethodImplAttribute constructor is not supported and will not result in synchronized behavior.
Check it here http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.runtime.compilerservices.methodimploptions%28v=vs.105%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With