Edit on GitHub

xUnit3000 Error

Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject

Cause

Test case classes must derive from LongLivedMarshalByRefObject to correctly support both desktop CLR (with app domains) and non-desktop CLR (without app domains).

Reason for rule

xUnit.net test case objects must live in the execution app domain, and must be able to live longer than the default 5 minutes.

How to fix violations

To fix a violation of this rule, use Xunit.LongLivedMarshalByRefObject as the base class for your test case class.

Examples

Violates

using Xunit.Abstractions;

public class xUnit3000 : ITestCase
{
    // ...implementation of test case...
}

Does not violate

using Xunit;
using Xunit.Abstractions;

public class xUnit3000 : LongLivedMarshalByRefObject, ITestCase
{
    // ...implementation of test case...
}
Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.