Skip to content

Commit

Permalink
Fxied bug in ExtractGenericArgumentDataContextChangeAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasherceg committed Sep 28, 2023
1 parent b3dcbc7 commit abb2229
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public ExtractGenericArgumentDataContextChangeAttribute(Type genericType, int ty

public override Type? GetChildDataContextType(Type dataContext, DataContextStack controlContextStack, DotvvmBindableObject control, DotvvmProperty? property = null)
{
var implementations = ReflectionUtils.GetBaseTypesAndInterfaces(dataContext).ToList();
var implementations = ReflectionUtils.GetBaseTypesAndInterfaces(dataContext)
.Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == GenericType)
.ToList();
if (implementations.Count == 0)
{
throw new Exception($"The data context {dataContext} doesn't implement {GenericType}!");
Expand Down
1 change: 1 addition & 0 deletions src/Framework/Framework/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ public static IEnumerable<Type> GetBaseTypesAndInterfaces(Type type)
yield return i;
}

yield return type;
while (type.BaseType is { } baseType)
{
yield return baseType;
Expand Down

0 comments on commit abb2229

Please sign in to comment.