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
abstract class Base
{
public abstract string Value { get; }
}
abstract class Base<T> : Base
{
}
class IntChild : Base<int>
{
public override string Value => "Int";
}
class StringChild : Base<string>
{
public override string Value => "String";
}
the Base.Value property gets decompiled as null
The below change fixes it:
@@ -9,10 +9,14 @@ static class TypeHierarchy
public static IEnumerable<Type> Traverse(Type root, IEnumerable<Type> ancestors)
{
var result = new List<Type>();
var children = ancestors.ToLookup(t => t.BaseType);
var children = ancestors.ToLookup(t =>
t.BaseType.IsGenericType && !t.BaseType.IsGenericTypeDefinition // This covers hierarchies which include intermediate generic class like C -> B<int> -> A, D -> B<string> -> A
? t.BaseType.GetGenericTypeDefinition()
: t.BaseType);
if (!root.IsInterface)
{
Traverse(result, root, children);
Traverse(result, root, children);
}
else
{
The text was updated successfully, but these errors were encountered:
For the case like below
the
Base.Value
property gets decompiled asnull
The below change fixes it:
The text was updated successfully, but these errors were encountered: