Bug 41178 - Enum.GetName behaviour does not match ms .NET implementation
Summary: Enum.GetName behaviour does not match ms .NET implementation
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
: 25628 ()
Depends on:
Reported: 2016-05-19 14:03 UTC by Ademar Gonzalez
Modified: 2017-03-23 13:13 UTC (History)
4 users (show)

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:

Description Ademar Gonzalez 2016-05-19 14:03:38 UTC
Sample code:

using System;

namespace TestConsole
	public enum OpcodeType : byte
		OP_0 = 0x00,
		OP_TRUE = OP_1,
		OP_1 = 0x51,
		OP_2 = 0x52
	class MainClass
		public static void Main (string[] args)
			Console.WriteLine (Enum.GetName(typeof(OpcodeType), OpcodeType.OP_1));

Expected output:


Actual output:


reference: https://github.com/MetacoSA/NBitcoin/issues/162

Ademars-MacBook-Pro:~ ademar$ mono -V
Mono JIT compiler version 4.2.3 (explicit/832de4b Thu Mar  3 19:24:57 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          yes(3.6.0svn-mono-(detached/a173357)
    GC:            sgen
Comment 1 Marek Safar 2016-05-23 07:52:42 UTC
*** Bug 25628 has been marked as a duplicate of this bug. ***
Comment 2 Andres G. Aragoneses 2016-05-23 07:58:34 UTC
> Marek Safar <msafar@...> changed:
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Summary|[regression] Enum.GetName   |Enum.GetName behaviour does
>                    |behaviour does not match ms |not match ms .NET
>                    |.NET implementation         |implementation

Marek, why do you remove the [regression] prefix? I told Ademar to add it because I cannot reproduce this bug in Mono 4.2.1 (Debian
Comment 3 Marek Safar 2016-05-23 08:01:56 UTC
It's not really regression as the behaviour is undefined/implementation specific
Comment 4 Marek Safar 2017-03-23 13:13:53 UTC
The latest .net version now prints OP_TRUE too