Bug 5567 - Enum.ToString behaves incorrectly in corner cases
Summary: Enum.ToString behaves incorrectly in corner cases
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 2.10.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-06-07 11:09 UTC by Alan McGovern
Modified: 2012-06-07 16:32 UTC (History)
4 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 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.

Related Links:
Status:
RESOLVED FIXED

Description Alan McGovern 2012-06-07 11:09:30 UTC
[Flags]
public enum UIControlState : uint
{
	Normal = 0u,
	Highlighted = 1u,
	Disabled = 2u,
	Selected = 4u,
	Application = 16711680u,
	Reserved = 4278190080u
}


1) Declare this enum
2) Create a program which does:  Console.WriteLine (UIControlState.Normal.ToString ())

Result:
'0' is printed instead of 'Normal'

Removing some members from the enum 'fixes' the problem.
Comment 1 Gonzalo Paniagua Javier 2012-06-07 12:35:10 UTC
It does not happen with mono from master.
Comment 2 Alan McGovern 2012-06-07 15:17:12 UTC
This is a 2.10.x buglet
Comment 3 Miguel de Icaza [MSFT] 2012-06-07 16:32:38 UTC
The bug was in Array.BinarySearch, backported Zoltan's patch from mono/master:

13d2cbd195ad0cd21b55bc0016fecffe47ee4455

This fixes the issue.