Table of Contents
  v2 v3   Error

xUnit9005

"Generic collection definitions are not supported"

Cause

A violation of this rule occurs when a collection definition class is declared as generic.

Reason for rule

Collection definition classes are most often declared as generic in order to support open generic fixture types. However, open generics require runtime reflection features that are not available in Native AOT.

How to fix violations

To fix a violation of this rule, remove the generic declaration on the collection definition (and use non-generic or closed-generic fixture types instead).

Examples

Violates

using Xunit;

[CollectionDefinition]
public class xUnit9005<T> : ICollectionFixture<MyFixture<T>>
{ }

Does not violate

using Xunit;

[CollectionDefinition]
public class xUnit9005 : ICollectionFixture<MyFixture<int>>
{ }