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
GitHub or Developer Community 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.
Here’s some code:
public enum SomeValues
v1 = 1,
v2 = 2,
latest = v2,
static void Main(string args)
var v1AsString = SomeValues.v1.ToString();
var v2AsString = SomeValues.v2.ToString();
var latestAsString = SomeValues.latest.ToString();
Here’s what it outputs on .net/Windows:
And on Mono/Android:
Expected - same output.
This is fixed in Mono 3.0.x, and should be fixed in Xamarin.Android 4.7.x.
Possibly not a bug!
My team mate (Clay) rightly points to:
http://msdn.microsoft.com/en-us/library/16c1xs4z.aspx it says
Notes to Callers
If multiple enumeration members have the same underlying value and you attempt to retrieve the string representation of an enumeration member's name based on its underlying value, your code should not make any assumptions about which name the method will return. For example, the following enumeration defines two members, Shade.Gray and Shade.Grey, that have the same underlying value.
White = 0, Gray = 1, Grey = 1, Black = 2
The following method call attempts to retrieve the name of a member of the Shade enumeration whose underlying value is 1. The method can return either "Gray" or "Grey", and your code should not make any assumptions about which string will be returned.
string shadeName = ((Shade) 1).ToString();
With your code latest and v2 are both assigned an integer value of 2, so the runtime is free to pick whichever one it feels like.