From 28d1abc83b7c08c564f026057f696426cd7a5e38 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 31 Mar 2017 18:50:36 +0100 Subject: [PATCH] Fallback for enum.Format(G) when not valid (dotnet/coreclr#10610) Commit migrated from https://github.com/dotnet/coreclr/commit/82e2735a477ffbfd7e8a67f5323c0c964da2a16f --- src/coreclr/src/mscorlib/src/System/Enum.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/src/mscorlib/src/System/Enum.cs b/src/coreclr/src/mscorlib/src/System/Enum.cs index 2403b6a..489f367 100644 --- a/src/coreclr/src/mscorlib/src/System/Enum.cs +++ b/src/coreclr/src/mscorlib/src/System/Enum.cs @@ -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(); -- 2.7.4