Skip to content

Commit 85edb0a

Browse files
committed
add warning about using interfaces with Inherit rule
1 parent cc2fa19 commit 85edb0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/NetArchTest.Rules/Functions/FunctionDelegates.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ internal static IEnumerable<TypeSpec> HaveCustomAttributeOrInherit(IEnumerable<T
3838

3939
internal static IEnumerable<TypeSpec> Inherit(IEnumerable<TypeSpec> input, Type type, bool condition)
4040
{
41+
if (type.IsInterface)
42+
{
43+
throw new ArgumentException($"The type {type.FullName} is an interface. interfaces are implemented not inherited, please use ImplementInterface instead.");
44+
}
45+
4146
// Convert the incoming type to a definition
4247
var target = type.ToTypeDefinition();
4348
if (condition)

0 commit comments

Comments
 (0)