I have a type that inherits from Microsoft.AspNetCore.ActionResult and it is detected as inheriting from Microsoft.EntityFrameworkCore.DbContext, even though it does not.
This appears to be because the TypeDefinitions for ActionResult and DbContext have the same MetadataToken, which is all TypeDefinitionExtensions.IsSubClassOf checks for. However, a MetadataToken only uniquely identifies a type within a Module, not in general.
To correctly determine if one class inherits from another, TypeDefinitionExtensions.IsSubClassOf should also ensure that the Module of the two TypeDefinitions match.
I have a type that inherits from Microsoft.AspNetCore.ActionResult and it is detected as inheriting from Microsoft.EntityFrameworkCore.DbContext, even though it does not.
This appears to be because the TypeDefinitions for ActionResult and DbContext have the same MetadataToken, which is all TypeDefinitionExtensions.IsSubClassOf checks for. However, a MetadataToken only uniquely identifies a type within a Module, not in general.
To correctly determine if one class inherits from another, TypeDefinitionExtensions.IsSubClassOf should also ensure that the Module of the two TypeDefinitions match.