Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
It appears that XmlConvert.ToUint16/32/64 throw wrong/inconsistent exception when called with an invalid argument. More specifically, when calling XmlConvert.ToUint32("-1") Xamarin Android throws an OverflowException. While .Net and Windows Phone 8.1 both throw a FormatExcetion.
The msdn documentation lists both exceptions as possibilities while making this call. However, it seems FormatException to take precedence over OverflowException.
To reproduce, run the following code snippet:
System.Double v2 = (System.Double)(-1);
System.String v3 = System.Xml.XmlConvert.ToString((System.Double)v2) ;
System.UInt32 v4 = System.Xml.XmlConvert.ToUInt32((System.String)v3) ;
Windows result: FormatException thrown
Xamarin Android result: OverflowException
This code snippet was placed in a PCL project and was run on an android 4.4.2
emulator and a Windows Phone 8.1 emulator and .Net 4.5 on the Desktop
Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
I have checked this issue and observed that we are getting exception 'FormatException' for console application and exception 'OverflowException' for android application.
To reproduce this issue I have created a simple android app and a console app, and implement the code given in bug description in both the apps, and got the exception when I run the app.
Application Output for Android app : https://gist.github.com/Udham1/8e9dcd7d186d07a2cbce
Exception Log for console app : https://gist.github.com/Udham1/dd791e8687c2ca2cad6c
Ide Log : https://gist.github.com/Udham1/09b800944ff81c64f304
Screencast : http://www.screencast.com/t/V7cZng68
Environment Info :
=== Xamarin Studio ===
Version 5.9 (build 214)
Installation UUID: 1acc211c-3883-4e33-b4d2-ad3b5d55c2c8
Microsoft .NET 4.0.30319.18449
GTK+ 2.24.22 (MS-Windows theme)
=== Xamarin.Android ===
Version: 5.1.0 (Business Edition)
Android SDK: D:\Backup_OldMachine\D Drive\SDK\SDK\android-sdk
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: C:\Program Files\Java\jdk1.7.0_67
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
=== Xamarin Android Player ===
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe
=== Build Information ===
Release ID: 509000214
Git revision: 1cd56e8fd54e4884caf1d509d793cbaf386b606d
Build date: 2015-03-13 08:29:20-04
Xamarin addins: d5276b9c69b0cc42f2bac6f30f741b1761b7e125
=== Operating System ===
Windows 6.2.9200.0 (64-bit)
Fixed on mono master, as a result of the move to System.XML from referencesource.
Note: this should be fixed as of ~ 50db47379083f823d0942870468df1fcda971f97 . This was tested with f482b9bd9b890cd99c3b93872a337b2b65f8f12b though.