Fallback for enum.Format(G) when not valid (dotnet/coreclr#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)
Commit migrated from https://github.com/dotnet/coreclr/commit/82e2735a477ffbfd7e8a67f5323c0c964da2a16f

src/coreclr/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();