Bug 27771 - Unified biniding returns the incorrect value for float property on 64bit devices
Summary: Unified biniding returns the incorrect value for float property on 64bit devices
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.6.0
Hardware: PC Mac OS
: Highest normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-09 07:58 UTC by Prashant Cholachagudda
Modified: 2015-03-09 08:14 UTC (History)
2 users (show)

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


Attachments
Testcase (92.65 KB, application/zip)
2015-03-09 07:59 UTC, Prashant Cholachagudda
Details


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:
Status:
RESOLVED ANSWERED

Description Prashant Cholachagudda 2015-03-09 07:58:50 UTC
When a field of the float type gets initialized in the native code, the  corresponding nfloat field in the resulting C# object is not set 
correctly. This only occurs on 64 Bit devices (e.g iPhone 5S+).

The attached sample projects which should help reproduce the bug. When running the "Unified-Bugtesting" Project on an iPhone 5 the label will display 25, the correct value assigned to the field in the  constructor of LibTest.

When starting the same project on an iPhone 5S+ the label will display 5,4256.... (i.e.5.45263811032947E-315) The expected result is of course 25.
Comment 1 Prashant Cholachagudda 2015-03-09 07:59:18 UTC
Created attachment 10215 [details]
Testcase
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-03-09 08:14:47 UTC
This is because the native field is defined as a 32-bit float:

    @property (nonatomic, assign) float maxZoom;

and it's incorrect to bind it as 'nfloat' in C#, it must be bound as 'float'.