[Mono-bugs] [Bug 80298][Wis] New - Enum.ToString("X") outputs e.g. "000000d1" versus MSFT "D1" etc
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Mon Dec 18 06:40:15 EST 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by andyhume32 at yahoo.co.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=80298
--- shadow/80298 2006-12-18 06:40:15.000000000 -0500
+++ shadow/80298.tmp.6482 2006-12-18 06:40:15.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 80298
+Product: Mono: Class Libraries
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: andyhume32 at yahoo.co.uk
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Enum.ToString("X") outputs e.g. "000000d1" versus MSFT "D1" etc
+
+I don't know what level of "same behaviour" is being aimed for. This
+seems at the far end of the spectrum, but I'll report it anyway. It may
+well be WONTFIX, or erm NOTABUG.
+
+The result of enumValue.ToString("X") is different on Mono from MSFT. In
+the case of the following
+
+ enum FooByteEnum : byte{
+ ...
+ }
+
+On the MSFT CLRv2 it returns e.g. "D1", whereas on Mono it
+returns "000000d1". Similarly "02" versus "00000002".
+
+On a enum with the underlying type not set (thus Int32), the outputs
+are: "000000D1" versus "000000d1", and both produce "00000002".
+
+A set of unit-tests is attached.
+
+
+In my code base I've changed my code to cope:
+
+ String msg = String.Format
+(System.Globalization.CultureInfo.InvariantCulture,
+ ExMsgPrefix_UnexpectedResponseCode + "0x{2:X2} ({0:G}){1}.",
+ m_code, reason,
+ // We want the response code enum to be formatted as e.g. 0xD1,
+ // Enum.ToString in FXv2 does that (the underlying type is Byte
+ // after all).
+ // However:
+ // * NETCFv1 -- Doesn't support the X formatting code at all.
+ // * Mono-1.2.2.1 -- Formats it as e.g. 0x000000d1.
+ (byte)m_code // Cause use Byte.ToString
+ );
More information about the mono-bugs
mailing list