[Analyzer Proposal]: warn when calling GetType()
on a System.Type
#108200
Labels
area-System.Runtime
code-analyzer
Marks an issue that suggests a Roslyn analyzer
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
I've noticed a few times where folks make a mistake through refactoring or copy-paste (or AI hallucinations) where they call
GetType()
on aSystem.Type
object. This doesn't cause any compile errors sinceSystem.Type
is anobject
and therefore has aGetType()
method - but it's more often the wrong thing to do than not.I suggest we add an analyzer that warns folks when they do this.
The text was updated successfully, but these errors were encountered: