site/xunit.analyzers/rules/xUnit9011.md
A violation of this rule occurs when a theory parameter uses the params modifier.
When using the reflection-based version of xUnit.net, it will attempt to examine your data values at runtime and dynamically construct the params array on your behalf. This requires reflection features that are not available in Native AOT.
To fix a violation of this rule, remove the params modifier on the parameter, and update your theory data to create the array yourself.
using Xunit;
public class xUnit9011
{
[Theory]
[InlineData("Hello world", 42)]
[InlineData("Hello world", 2112, 2600)]
public void TheoryMethod(string greeting, params int[] values)
{ }
}
using Xunit;
public class xUnit9011
{
[Theory]
[InlineData("Hello world", new[] { 42 })]
[InlineData("Hello world", new[] { 2112, 2600 })]
public void TheoryMethod(string greeting, int[] values)
{ }
}