Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
My ArchUnit tests test for assignability across multiple layers of inheritance, like so:
// Assembly 1
public class Parent;
// Assembly 2
public class Child : Parent;
// Assembly 3
public class Grandchild : Child;
// ArchUnit test
public class Tests
{
private static readonly Architecture Architecture = new ArchLoader()
.LoadAssemblies(typeof(Parent).Assembly, typeof(Child).Assembly, typeof(Grandchild).Assembly)
.Build();
[Fact]
public void Test()
{
Classes().That().Are(typeof(Grandchild))
.Should().BeAssignableTo(typeof(Parent))
.Check(Architecture);
}
}(I created a minimal example, which you can find here: https://github.com/tnotheis/archunit-bug-example)
With version 0.11.0 this worked just fine. But since I upgraded to version 0.11.1, the test fails with the following error:
AssemblyOfGrandchild.Grandchild is not assignable to "AssemblyOfParent.Parent"
It only fails if Child and Grandchild reside in different assemblies. If you move the Grandchild class into AssemblyOfChild the test passes.
Reacted by NicolaSeitz and Philippe Fontaine
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Activity
NicolaSeitz commentedon Jan 22, 2025
Are there any Updates about this Bug?
alexanderlinne commentedon Jan 24, 2025
Hi, this is currently caused by types not being resolved correctly and is fixed by #318. I'll see that I get this PR merged soon.
alexanderlinne commentedon Jan 24, 2025
We've just released #318 as a preview release
0.11.3-preview.1. Would you be able to check whether this resolves this issue for you?NicolaSeitz commentedon Jan 24, 2025
I just tested my cases quickly and it looks like it works so far 😊
NicolaSeitz commentedon Jan 27, 2025
alexanderlinne commentedon Feb 14, 2025
NicolaSeitz commentedon Feb 14, 2025
alexanderlinne commentedon Feb 14, 2025
@NicolaSeitz Since this issue is separate from the original Issue discussed here, I've created a separate Issue to track this