Bug 20577 - XElement with float or decimal value
Summary: XElement with float or decimal value
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.14.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-06-13 06:10 UTC by Francesco Colombo
Modified: 2017-06-27 16:05 UTC (History)
3 users (show)

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

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 NOT_REPRODUCIBLE

Description Francesco Colombo 2014-06-13 06:10:07 UTC
I'm not sure, but it seems there's something "wrong" when using an XElement with decimal values. I'm creating an xml document with elements filled with decimals like this:

new XElement("elementName", decimalValue)
new XElement("elementName", (decimal)nullableDecimalValue)
new XElement("elementName", (float)nullableDecimalValue)

In any case, it happens that the value written in the xml is corrupted (for eg. "92834.24.24"). This is a really strange behaviour.
Comment 1 Atin 2014-06-13 07:48:37 UTC
I have tried this issue but I am unable to reproduce this issue.

Steps to reproduce this issue :

1. Open an “Android application” on Xamarin Studio.
2. Place the following code on  “onCreate()” of “MainActivity”.

           decimal decimalValue = 92834.1m;
   
           decimal? nullableDecimalValue = 92834.1m;
  
          XNamespace xmlNamespace = "http://www.test.com";

          XElement xmlTree1 = new XElement(aw + "Root",
 new XElement("Child1", 1),
             
                                            new XElement("DecimalValueChild", decimalValue),

                                            new XElement("NullableDecimalValue1",  (decimal)nullableDecimalValue),
 
                                            new XElement("NullableDecimalValue2", (float)nullableDecimalValue)
 
                       );


3. Debug the “application”.
4. Check the value of xml on “Application Output”.

I observed that the xml value is not corrupted while writing.

Screencast: http://www.screencast.com/t/IsK7NTZJMtj

Could you please attached sample project and XS full build information (Xamarin Studio=>About Xamarin Studio=> Show details)? so that I can reproduce this issue at our end.

Environment Info:

Mac OS X 10.9.2
Xamarin Studio: 5.0 (build 878)

Xamarin.Android: 4.12.4

Build Information
Release ID: 500000878
Git revision: bcd66920d963483e7d638a2339c4022fe035b529
Build date: 2014-05-27 17:36:26-04
Xamarin addins: da9064ce55b0fa90930a7c437a4cc1ae0e5c778c
Comment 2 Francesco Colombo 2014-06-16 09:23:50 UTC
I've created a simple app too, but I'm unable to reproduce the issue. It seems something related to the logic of our app. I need to "export" the core logic which cause the issue in a test app. Once it is done, I'll come back to you.
Comment 3 Chris Hardy [MSFT] 2017-06-27 16:05:22 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Android project adding just the code necessary to demonstrate the issue.