Bug 12007 - float values are being corrupted/lost when inserted into a Queue<float> (likely a code generation issue)
Summary: float values are being corrupted/lost when inserted into a Queue<float> (like...
Alias: None
Product: Android
Classification: Xamarin
Component: Pre-release ()
Version: 4.7.x
Hardware: All All
: --- normal
Target Milestone: 4.8 (async)
Assignee: Alex Rønne Petersen
: 12519 ()
Depends on:
Reported: 2013-04-27 19:15 UTC by T.J. Purtell
Modified: 2013-07-11 11:40 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Activity showing working vs. not working float collection examples (1.73 KB, text/plain)
2013-04-27 19:15 UTC, T.J. Purtell

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description T.J. Purtell 2013-04-27 19:15:29 UTC
Created attachment 3887 [details]
Activity showing working vs. not working float collection examples

I am seeing corrupted floating point values using the 4.7.4 Alpha for Xamarin.Android. I used the default API-level 10 emulator to observe this error as well as a brand new (but extremely cheap Android 2.3 phone).  If I use a System.Collections.Generic.Queue to store values, then Dequeue corrupts the values.  However, it works with a non-generic queue as well as a generic queue of doubles.

Test app code is here: http://pastebin.com/Athng069

This error does not occur on the previous stable release series (4.6.4).
Comment 1 PJ 2013-04-29 11:00:15 UTC
Thanks for the report!
Comment 2 Jonathan Pryor 2013-04-30 17:19:59 UTC
The test fails on armeabi hardware, e.g. the Android 2.3.3 emulator, not armeabi-v7a.

I'm guessing it's a JIT bug.
Comment 3 Alex Rønne Petersen 2013-05-17 15:15:45 UTC
This was caused by Mono revision 8f7a7a74 which made invalid assumptions about the target FPU. The code the commit touched was relevant for Android too, where the assumption is invalid.

Commit 89c3c44d fixed it.
Comment 4 Jonathan Pryor 2013-06-04 11:18:27 UTC
*** Bug 12519 has been marked as a duplicate of this bug. ***
Comment 5 Saurabh 2013-06-28 14:52:46 UTC
We have checked this issue with XS 4.0.9 build 12 and MFA :

As this bug is duplicate of bug 12519.
And by using following code from Bug 12519:

namespace TestApp {
    [Activity (Label = "TestApp", MainLauncher = true)]
    public class Activity1 : Activity {

        protected override void OnCreate (Bundle bundle)
            base.OnCreate (bundle);

            var testClass = new TestClass ();
            float prop1 = testClass.Prop1;

            Console.WriteLine ("Get Prop1: {0}", prop1);

    public class TestClass {
        public float Prop1 { get { return 0.5f; } }

and on running application we get 'Get Prop1: 0.5' in console output.


And when we tried it with application code: http://pastebin.com/Athng069

Application run successfully and we get following in console output:
[monodroid-gc] GREF GC Threshold: 1800
result = 1, as hex = 0000803F

We are not clear about expected result. 

Let us know, is it expected result or not.
Comment 6 T.J. Purtell 2013-06-28 14:58:29 UTC
0.5 is correct.  0.0 was the errant result it was returning before.