I had a bug pop up after my switch to MF 4.2 RTM. But, this is my own firmware build, so can someone confirm this for me on 4.2 RC3? I think it is the same issue as Stavros Tekes's issue. Basically, I finally tracked it down to this line (which was returning values in the 500000 range!):
var fullBlockCount2 = (int)System.Math.Floor(24 / 3);
var totalBlockCount2 = (int)System.Math.Ceiling(24 / 3);
So, I did some testing in the immediate window while running on the Emulator:
System.Math.Ceiling(3.2d)
4.0
System.Math.Ceiling(3)
3.0
System.Math.Ceiling(3.2)
4.0
System.Math.Floor(3.2d)
3.0
System.Math.Floor(3)
3.0
System.Math.Floor(3.2)
3.0
Then the Netduino:
System.Math.Ceiling(3.2d)
262144
System.Math.Ceiling(3)
196608
System.Math.Ceiling(3.2)
262144
System.Math.Floor(3.2d)
196608
System.Math.Floor(3)
196608
System.Math.Floor(3.2)
196608
THIS IS BAD. Strangely though, if you assign the result to a variable of type double, it returns the correct value. So if I change my code to this (casting removed), it works on Netduino:
var fullBlockCount2 = System.Math.Floor(24 / 3);
var totalBlockCount2 = System.Math.Ceiling(24 / 3);
This implies to me that it's the double -> int type inference. What's scares me is that this could be messing up calculations all over my code and I might be missing it.
-Valkyrie-MT