Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject
Classes which may cross AppDomain boundaries must derive from LongLivedMarshalByRefObject to correctly support both .NET Framework (with app domains) and .NET Core (without app domains).
Classes that implement one of the cross-AppDomain interface types (from the Xunit.Abstractions
namespace) must be able to be proxied across
AppDomain boundaries, and must be able to survive for longer than the default 5 minutes.
To fix a violation of this rule, use LongLivedMarshalByRefObject
as the base class for your class. If your class lives on the runner side, then
use Xunit.Sdk.LongLivedMarshalByRefObject
; if your class lives on the execution side, use Xunit.LongLivedMarshalByRefObject
.
using Xunit.Abstractions;
public class xUnit3000 : ITestCase
{
// ...implementation of test case...
}
using Xunit;
using Xunit.Abstractions;
public class xUnit3000 : LongLivedMarshalByRefObject, ITestCase
{
// ...implementation of test case...
}