Bug 52653 - Likely wrong enum value displayed
Summary: Likely wrong enum value displayed
Status: CONFIRMED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger (show other bugs)
Version: Trunk
Hardware: PC Mac OS
: Low minor
Target Milestone: master
Assignee: David Karlaš
URL:
Depends on:
Blocks:
 
Reported: 2017-02-21 22:44 UTC by Vincent Dondain [MSFT]
Modified: 2017-05-25 19:49 UTC (History)
3 users (show)

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


Attachments

Description Vincent Dondain [MSFT] 2017-02-21 22:44:26 UTC

    
Comment 1 Vincent Dondain [MSFT] 2017-02-21 22:49:50 UTC
Oops pressed enter by mistake, here's the description:

Please compare the results of both enums:

Case 1:

enum HMCharacteristicValueContactState
{
	// Obsolete
	Detected2 = 0,
	None = Detected2,
	// Obsolete
	Detected = 1,
	None2 = Detected,
}

Result for Console.Writeline:

HMCharacteristicValueContactState.None = None
HMCharacteristicValueContactState.Detected2 = None
HMCharacteristicValueContactState.Detected = Detected
HMCharacteristicValueContactState.None2 = Detected

I'd expect the following output:

HMCharacteristicValueContactState.None = Detected2
HMCharacteristicValueContactState.Detected2 = Detected2
HMCharacteristicValueContactState.Detected = Detected
HMCharacteristicValueContactState.None2 = Detected

-----

Case 2:

enum HMCharacteristicValueContactState
{
	// Obsolete
	None = 0,
	Detected2 = None,
	// Obsolete
	Detected = 1,
	None2 = Detected,
}

Result for Console.Writeline:

HMCharacteristicValueContactState.None = Detected2
HMCharacteristicValueContactState.Detected2 = Detected2
HMCharacteristicValueContactState.Detected = Detected
HMCharacteristicValueContactState.None2 = Detected

Basically in case 2 I would expect the following result:

HMCharacteristicValueContactState.None = None
HMCharacteristicValueContactState.Detected2 = None
HMCharacteristicValueContactState.Detected = Detected
HMCharacteristicValueContactState.None2 = Detected

See how the first 2 results seem wrong and the last 2 seem correct?

Let me know if there's a logical explanation to this or if it's a real bug.
Comment 2 Mike Krüger 2017-03-01 08:09:02 UTC
btw. my test case:

using System;

enum HMCharacteristicValueContactState
{
	// Obsolete
	Detected2 = 0,
	None = Detected2,
	// Obsolete
	Detected = 1,
	None2 = Detected,
}

class Test
{
	public static void Main(string[] args)
	{
		var e = HMCharacteristicValueContactState.Detected2;
		Console.WriteLine(e);
	}
}


Break point on e - our info & writeline differs.

Note You need to log in before you can comment on or make changes to this bug.