In VS I'm in debug mode, when I debug the test it seems to execute just fine, 100% of the time, when I run the test and the resiliancepipeline throws a couple of exceptions (for the multiple failures) it just spins forever (I left a 1 second test for many minutes to check this) unwinding a stacktrace. This did not happen when I was using the non-preview version of VS and XUnit, only when I ported to Preview with TUnit.
Running via dotnet test shows the stacktrace being written to the console for over 5 minutes.
I've speculatively included information I think may be helpful, let me know if I can provide something else.
TUnit Version: 0.2.26
Operating System: Windows 10 Pro
Visual Studio Version: 2022 (640bit) - Preview (17.12.0 Preview 4.0)
.NET Version: net8.0
Extensions: The only installed extension is ReSharper, I disabled this and the test still failed in the same way.
The Test:
[Test]
[MethodDataSource(typeof(TestBase), nameof(TestData))]
public async Task TestSomething(SomeType someType)
{
...
TestData in base class
public static IEnumerable<SomeType > TestData()
{
yield return ManyTypes.SomeType;
}
Generated Test Hooks:
// <auto-generated/>
#pragma warning disable
using global::System.Linq;
using global::System.Reflection;
using global::System.Runtime.CompilerServices;
using global::TUnit.Core;
using global::TUnit.Core.Interfaces;
namespace TUnit.SourceGenerated;
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
file partial class Hooks_REDACTED_Tests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource
{
[global::System.Runtime.CompilerServices.ModuleInitializer]
public static void Initialise()
{
var instance = new Hooks_REDACTED_Tests();
SourceRegistrar.RegisterTestHookSource(instance);
}
public global::System.Collections.Generic.IReadOnlyList<StaticHookMethod<TestContext>> CollectBeforeEveryTestHooks()
{
return
[
];
}
public global::System.Collections.Generic.IReadOnlyList<StaticHookMethod<TestContext>> CollectAfterEveryTestHooks()
{
return
[
];
}
public global::System.Collections.Generic.IReadOnlyList<InstanceHookMethod> CollectBeforeTestHooks()
{
return
[
];
}
public global::System.Collections.Generic.IReadOnlyList<InstanceHookMethod> CollectAfterTestHooks()
{
return
[
new InstanceHookMethod<global::REDACTED.Tests>
{
MethodInfo = typeof(global::REDACTED.Tests).GetMethod("REDACTED", 0, []),
Body = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.REDACTED()),
HookExecutor = DefaultExecutor.Instance,
Order = 0,
},
];
}
}
Generated Tests:
// <auto-generated/>
#pragma warning disable
using global::TUnit.Core;
using global::System.Reflection;
using global::System.Linq;
namespace TUnit.SourceGenerated;
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
file partial class REDACTED_Tests : TUnit.Core.Interfaces.SourceGenerator.ITestSource
{
[global::System.Runtime.CompilerServices.ModuleInitializer]
public static void Initialise()
{
SourceRegistrar.Register(new REDACTED_Tests());
}
public global::System.Collections.Generic.IReadOnlyList<SourceGeneratedTestNode> CollectTests()
{
return
[
..Tests0(),
];
}
private global::System.Collections.Generic.List<SourceGeneratedTestNode> Tests0()
{
global::System.Collections.Generic.List<SourceGeneratedTestNode> nodes = [];
var classDataIndex = 0;
var testMethodDataIndex = 0;
try
{
var testClassType = typeof(global::REDACTED.Tests);
var methodInfo = typeof(global::REDACTED.Tests).GetMethod("REDACTED_MethodName", 0, [typeof(global::REDACTED.TestData)]);
var objectBag = new global::System.Collections.Generic.Dictionary<string, object>();
var resettableClassFactoryDelegate = () => new ResettableLazy<global::REDACTED.Tests>(() =>
new global::REDACTED.Tests()
);
var resettableClassFactory = resettableClassFactoryDelegate();
foreach (var methodData in global::REDACTED.Tests.SomethingTest())
{
testMethodDataIndex++;
nodes.Add(new TestMetadata<global::REDACTED.Tests>
{
TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:REDACTED.Tests.REDACTED_MethodName(REDACTED.TestData):0",
TestClassArguments = [],
TestMethodArguments = [methodData],
TestClassProperties = [],
CurrentRepeatAttempt = 0,
RepeatLimit = 0,
MethodInfo = methodInfo,
ResettableClassFactory = resettableClassFactory,
TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.REDACTED_MethodName(methodData)),
TestExecutor = DefaultExecutor.Instance,
ParallelLimit = null,
TestFilePath = @"REDACTED_PATH",
TestLineNumber = 165,
AttributeTypes = [ typeof(global::TUnit.Core.TestAttribute), typeof(global::System.Runtime.CompilerServices.NullableContextAttribute), typeof(global::System.Runtime.CompilerServices.NullableAttribute), typeof(global::System.Runtime.Versioning.TargetFrameworkAttribute), typeof(global::System.Reflection.AssemblyCompanyAttribute), typeof(global::System.Reflection.AssemblyConfigurationAttribute), typeof(global::System.Reflection.AssemblyFileVersionAttribute), typeof(global::System.Reflection.AssemblyInformationalVersionAttribute), typeof(global::System.Reflection.AssemblyProductAttribute), typeof(global::System.Reflection.AssemblyTitleAttribute), typeof(global::System.Reflection.AssemblyVersionAttribute), typeof(global::System.Reflection.AssemblyMetadataAttribute) ],
DataAttributes = [ ],
ObjectBag = objectBag,
});
resettableClassFactory = resettableClassFactoryDelegate();
}
}
catch (global::System.Exception exception)
{
nodes.Add(new FailedInitializationTest
{
TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:REDACTED.Tests.REDACTED_MethodName(REDACTED.TestData):0",
TestClass = typeof(global::REDACTED.Tests),
ReturnType = typeof(global::REDACTED.Tests).GetMethod("REDACTED_MethodName", 0, [typeof(global::REDACTED.TestData)]).ReturnType,
ParameterTypeFullNames = [typeof(global::REDACTED.TestData)],
TestName = "REDACTED_MethodName",
TestFilePath = @"REDACTED_PATH",
TestLineNumber = 165,
Exception = exception,
});
}
return nodes;
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4