From 729501d68c9b3b932ea171828131cb7e45bb9395 Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Thu, 18 Jul 2024 14:52:13 -0700 Subject: [PATCH] Inverted IsAssignableFrom and use unbound generic for Attribute --- src/xunit.analyzers/X1000/EnsureFixturesHaveASource.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xunit.analyzers/X1000/EnsureFixturesHaveASource.cs b/src/xunit.analyzers/X1000/EnsureFixturesHaveASource.cs index 98ff1a90..4557cb95 100644 --- a/src/xunit.analyzers/X1000/EnsureFixturesHaveASource.cs +++ b/src/xunit.analyzers/X1000/EnsureFixturesHaveASource.cs @@ -21,7 +21,7 @@ public override void AnalyzeCompilation( Guard.ArgumentNotNull(xunitContext); var collectionAttributeType = xunitContext.Core.CollectionAttributeType; - var collectionAttributeOfTType = xunitContext.V3Core?.CollectionAttributeOfTType; + var collectionAttributeOfTType = xunitContext.V3Core?.CollectionAttributeOfTType?.ConstructUnboundGenericType(); var collectionDefinitionAttributeType = xunitContext.Core.CollectionDefinitionAttributeType; context.RegisterSymbolAction(context => @@ -51,7 +51,7 @@ public override void AnalyzeCompilation( collectionDefinition = type .GetAttributes() - .FirstOrDefault(a => a.AttributeClass.IsAssignableFrom(collectionAttributeType)) + .FirstOrDefault(a => collectionAttributeType.IsAssignableFrom(a.AttributeClass)) ?.ConstructorArguments .FirstOrDefault() .Value; @@ -61,7 +61,7 @@ public override void AnalyzeCompilation( collectionDefinition = type .GetAttributes() - .FirstOrDefault(a => a.AttributeClass.IsAssignableFrom(collectionAttributeOfTType)) + .FirstOrDefault(a => collectionAttributeOfTType.IsAssignableFrom(a.AttributeClass)) ?.AttributeClass ?.TypeArguments .FirstOrDefault();