Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions TUnit.Engine/Services/AfterHookPairTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ public ValueTask<List<Exception>> GetOrCreateAfterTestSessionTask(Func<ValueTask
/// </summary>
public ValueTask<List<Exception>> GetOrCreateAfterAssemblyTask(Assembly assembly, Func<Assembly, ValueTask<List<Exception>>> taskFactory)
{
// Lock-free fast path avoids allocating a closure on the common cache-hit case.
if (_afterAssemblyTasks.TryGetValue(assembly, out var existingTask))
{
return new ValueTask<List<Exception>>(existingTask);
}

var task = _afterAssemblyTasks.GetOrAdd(assembly, a => taskFactory(a).AsTask());
return new ValueTask<List<Exception>>(task);
}
Expand Down
Loading