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
publicclassAB{}publicenumABEnum{A=0,B=1}publicclassTest{publicvoidTestAB(){foreach(variteminEnum.GetValues(typeof(AB)))// should warn here - syntactically valid C# but will blow up at run-time. Caused due to developer typing AB instead of ABEnum{Console.WriteLine(((Enum)item).GetDisplayName());// Feature logged in: https://github.com/DotNetAnalyzers/ReflectionAnalyzers/issues/214// ^^^^^^^^^^^^ bonus: don't raise Possible InvalidCastException if typeof(ABEnum) is an enum defined as an int64 sub-class (default scenario).}}}
The text was updated successfully, but these errors were encountered:
I usually err on making too many diagnostics as it enables configuration via ruleset. For issues my preference is as small and many as possible. Have found it fastest to work with. If you are interested in trying your hand at writing analyzers for some of them just leave a note. Ask questions in chat if you happen to get stuck.
The text was updated successfully, but these errors were encountered: