You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Contract for Enum.GetName incorrectly states result not null #478
When building I get an incorrect warning about possible 'dead code' for the following IF statement:
foreach (char c in text)
{
var b = (byte)c;
var strASCII = Enum.GetName(typeof(AsciiSymbols), b);
if (strASCII != null)
expanded.Append("<" + strASCII + ">");
else
expanded.Append(c);
}
The problem seems to be an incorrect contract for Enum.GetName():
An examination of the source code shows that the result can in fact be null, so this is leading to a false positive in the warning.
Activity