Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to fix TUnit0300 when using InstanceMethodDataSource within an abstract, generic class #3177

Unanswered
TheRumle asked this question in Q&A
Discussion options

I have a statement giving me a warning:

// TUnit0300: Generic test method with data source may not be AOT-compatible. All generic type combinations must be known at compile time.
 [Test]
 [NotInParallel(nameof(WhenTraversingWithMatch_DoesNotThrowNotFound))]
 [InstanceMethodDataSource(nameof(PresentObjects))]
 [Timeout(10_0000)]
 public async Task WhenTraversingWithMatch_DoesNotThrowNotFound(NodeId id, CancellationToken token){...}

The method itself is contained within an abstract generic test class:

public abstract class NodeTreeTraverserTest<T>(ApplicationFixture<T> fixture) where T : INodeTreeTraverser{...}

I have spent some time trying out a few different things, but I cannot for the life of me understand how I should approach solving this warning? Maybe I lack knowledge within AOT... is there perhaps a good resource that explains why this is a problem, and moreover explains a solution?

You must be logged in to vote

Replies: 1 comment

Comment options

Are you using AOT?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /