site/xunit.analyzers/rules/xUnit9004.md
A violation of this rule occurs when a type used by code generation is not visible to the generated code.
There are situations the user defined code can be compiled, but generated code needs access to a type which is not reachable due to its declared visibility. This most commonly occurs with references to private nested types.
To fix a violation of this rule, declare the type as either public or internal.
using Xunit;
using Xunit.v3;
public class xUnit9004_BeforeAfter
{
[Fact, MyBeforeAfter]
public void TestMethod() { }
class MyBeforeAfter : BeforeAfterTestAttribute { }
}
using Xunit;
using Xunit.v3;
public class xUnit9004_BeforeAfter
{
[Fact, MyBeforeAfter]
public void TestMethod() { }
internal class MyBeforeAfter : BeforeAfterTestAttribute { }
}