Fallback for enum.Format(G) when not valid (#10610)
authorBen Adams <thundercat@illyriad.co.uk>
Fri, 31 Mar 2017 17:50:36 +0000 (18:50 +0100)
committerJan Kotas <jkotas@microsoft.com>
Fri, 31 Mar 2017 17:50:36 +0000 (10:50 -0700)
src/mscorlib/src/System/Enum.cs

index 2403b6a..489f367 100644 (file)
@@ -688,7 +688,7 @@ namespace System
 
             char formatCh = format[0];
             if (formatCh == 'G' || formatCh == 'g')
-                return GetEnumName(rtType, ToUInt64(value));
+                return GetEnumName(rtType, ToUInt64(value)) ?? value.ToString();
 
             if (formatCh == 'D' || formatCh == 'd')
                 return value.ToString();