I've noticed a few times where folks make a mistake through refactoring or copy-paste (or AI hallucinations) where they call GetType() on a System.Type object. This doesn't cause any compile errors since System.Type is an object and therefore has a GetType() 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.
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.