Skip to content

Commit

Permalink
Fix GetEventsOntypeHierarchy
Browse files Browse the repository at this point in the history
Same problem as dotnet#552 in properties. Found by accident, but should have done the due dilligence in dotnet#552.
  • Loading branch information
MichalStrehovsky committed Jan 13, 2021
1 parent 409f0e4 commit 7dd4742
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,14 @@ public static IEnumerable<EventPseudoDesc> GetEventsOnTypeHierarchy(this TypeDes
bool onBaseType = false;
while (type != null)
{
var ecmaType = (EcmaType)type.GetTypeDefinition();
if (type.GetTypeDefinition() is not EcmaType ecmaType)
{
// Go down the inheritance chain to see if we have an EcmaType later.
// Arrays would hit this (base type of arrays is the EcmaType for System.Array).
type = type.BaseType;
onBaseType = true;
continue;
}

foreach (var eventHandle in ecmaType.MetadataReader.GetTypeDefinition(ecmaType.Handle).GetEvents())
{
Expand Down

0 comments on commit 7dd4742

Please sign in to comment.