Error during parallel execution of the features Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
Reqnroll Version
2.1.0
Which test runner are you using?
xUnit
Test Runner Version Number
2.9.1
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
not present
Issue Description
Recently I have moved from SpecFLow to Reqnroll. Thank you for quite extensive migration documentation. It was quite easy.
But I have bumped into one issue. It is with parallel test execution. There was no issues with parallel execution at SpecFlow.
================ BeforeTestRun
[xUnit.net 00:00:02.03] Test title... [FAIL]
[xUnit.net 00:00:02.03] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.03] Stack Trace:
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.03] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.03] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.03] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
There is my Before Test Run hook that set ups wait time
using Reqnroll.BoDi;
using Reqnroll;
namespace some.name.space.e2e.Tests
{
[Binding]
public class Hooks
{
private readonly IReqnrollOutputHelper _outputHelper;
private IEnodeTestApiClientFactory _enodeTestApiClientFactory;
private readonly ScenarioContext _scenarioContext;
public Hooks(
ScenarioContext scenarioContext,
IReqnrollOutputHelper outputHelper,
IEnodeTestApiClientFactory enodeTestApiClientFactory)
{
_scenarioContext = scenarioContext;
_outputHelper = outputHelper;
_enodeTestApiClientFactory = enodeTestApiClientFactory;
}
[BeforeTestRun]
public static void BeforeTestRun()
{
Console.WriteLine("================ BeforeTestRun");
// Default is 1 second, which is not enough to resolve our ServiceCollection (see Startup.cs)
// if we run multiple features in parallel (this leads to "Concurrent object resolution timeout (potential circular dependency)." exception)
ObjectContainer.DefaultConcurrentObjectResolutionTimeout = TimeSpan.FromSeconds(30);
}
Build orde:
Build started at 7:42 ...
1>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure, Configuration: Debug Any CPU ------
1>C:\Eneco.Vpp.BehindTheMeter\src\Common\Core\Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure\Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure.csproj : warning NU1902: Package 'OpenTelemetry.Instrumentation.AspNetCore' 1.7.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-vh2m-22xx-q94f
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure -> C:\Eneco.Vpp.BehindTheMeter\src\Common\Core\Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure.dll
1>Done building project "Eneco.Vpp.BehindTheMeter.Common.Core.Infrastructure.csproj".
2>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Hems.Common.Infrastructure, Configuration: Debug Any CPU ------
2>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
2>Eneco.Vpp.BehindTheMeter.Hems.Common.Infrastructure -> C:\Eneco.Vpp.BehindTheMeter\src\Hems\Common\Eneco.Vpp.BehindTheMeter.Hems.Common.Infrastructure\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Hems.Common.Infrastructure.dll
3>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Common.Api.Application, Configuration: Debug Any CPU ------
3>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
3>Eneco.Vpp.BehindTheMeter.Common.Api.Application -> C:\Eneco.Vpp.BehindTheMeter\src\Common\Api\Eneco.Vpp.BehindTheMeter.Common.Api.Application\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Common.Api.Application.dll
4>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Hems.Api.Application, Configuration: Debug Any CPU ------
4>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
4>Eneco.Vpp.BehindTheMeter.Hems.Api.Application -> C:\Eneco.Vpp.BehindTheMeter\src\Hems\Api\Eneco.Vpp.BehindTheMeter.Hems.Api.Application\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Hems.Api.Application.dll
5>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Hems.Common.Api.Tests, Configuration: Debug Any CPU ------
5>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
5>Eneco.Vpp.BehindTheMeter.Hems.Common.Api.Tests -> C:\Eneco.Vpp.BehindTheMeter\src\Hems\Common\Eneco.Vpp.BehindTheMeter.Hems.Common.Api.Tests\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Hems.Common.Api.Tests.dll
6>------ Build started: Project: Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests, Configuration: Debug Any CPU ------
6>ReqnrollFeatureFiles: Features\DeviceSettingsAndState.feature;Features\Onboarding.feature;Features\PriceIngestionTests.feature;Features\TriggerAndScheduleGenerationWithoutPowerForecast.feature;Features\TriggerAndScheduleGenerationWithPowerForecast.feature
6>-> Using default config
6>ReqnrollGeneratedFiles: Features\DeviceSettingsAndState.feature.cs
6>ReqnrollGeneratedFiles: Features\Onboarding.feature.cs
6>ReqnrollGeneratedFiles: Features\PriceIngestionTests.feature.cs
6>ReqnrollGeneratedFiles: Features\TriggerAndScheduleGenerationWithoutPowerForecast.feature.cs
6>ReqnrollGeneratedFiles: Features\TriggerAndScheduleGenerationWithPowerForecast.feature.cs
6>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
6>Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests -> C:\Eneco.Vpp.BehindTheMeter\src\Hems\E2E-Tests\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.dll
========== Build: 6 succeeded, 0 failed, 9 up-to-date, 0 skipped ==========
========== Build completed at 7:42 and took 07,999 seconds ==========
Reqnroll
Info: OnActivityStarted: Starting Visual Studio Extension...
Info: CreateProjectScope: Initializing project: Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests
Info: StartRetryInitializeTimer: Project settings not available yet, retry in 5 seconds...
Info: OnSettingsInitialized: Project settings initialized: .NETCoreApp,Version=v8.0,Reqnroll:2.1.0
Info: ThenImportBindings: 49 step definitions and 6 hooks discovered for project Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests
Test Output
Log level is set to Informational (Default).
Connected to test environment '< Local Windows Environment >'
Test data store opened in 0,252 sec.
========== Starting test discovery ==========
========== Test discovery skipped: All test containers are up to date ==========
Building Test Projects
========== Starting test run ==========
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 8.0.8)
[xUnit.net 00:00:00.60] Starting: Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests
-> Loading plugin C:\Eneco.Vpp.BehindTheMeter\src\Hems\E2E-Tests\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests\bin\Debug\net8.0\Reqnroll.Microsoft.Extensions.DependencyInjection.ReqnrollPlugin.dll
-> Loading plugin C:\Eneco.Vpp.BehindTheMeter\src\Hems\E2E-Tests\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests\bin\Debug\net8.0\Reqnroll.xUnit.ReqnrollPlugin.dll
-> Loading plugin C:\Eneco.Vpp.BehindTheMeter\src\Hems\E2E-Tests\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests\bin\Debug\net8.0\Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.dll
-> Using default config
================ BeforeTestRun
[xUnit.net 00:00:02.03] Check that GET Device State returns correct information - External(customer: "customer_4_nl_device_state", country_Code: "NL", state: "PLUGGED_IN:CHARGING", level: "33", range: "330", location: "Home", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.03] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.03] Stack Trace:
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.03] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.03] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.03] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.03] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.03] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.04] Check that GET Device State returns correct information - External(customer: "customer_4_be_device_state", country_Code: "BE", state: "UNPLUGGED", level: "35", range: "350", location: "Home", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.04] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.04] Stack Trace:
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.04] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.04] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.04] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.04] Check that GET Device State returns correct information - External(customer: "customer_4_nl_device_state", country_Code: "NL", state: "UNPLUGGED", level: "36", range: "360", location: "Home", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.04] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.04] Stack Trace:
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.04] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.04] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.04] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.04] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.04] Check that GET Device State returns correct information - External(customer: "customer_4_be_device_state", country_Code: "BE", state: "PLUGGED_IN:CHARGING", level: "55", range: "550", location: "Home", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.04] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.04] Stack Trace:
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.04] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.05] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.05] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.05] Check that GET Device State returns correct information - Internal(customer: "customer_4_be_device_state", level: "35", range: "350", connected: "1", connected_Home: "0", charge_Rate: "5.1", charge_State: "ChargingAway", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.05] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.05] Stack Trace:
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.05] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.05] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.05] Check that GET Device State returns correct information - Internal(customer: "customer_4_nl_device_state", level: "95", range: "950", connected: "0", connected_Home: "0", charge_Rate: "0", charge_State: "Away", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.05] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.05] Stack Trace:
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.05] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.05] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.05] Check that GET Device State returns correct information - Internal(customer: "customer_4_nl_device_state", level: "25", range: "250", connected: "1", connected_Home: "1", charge_Rate: "4.1", charge_State: "Charging", exampleTags: []) [FAIL]
[xUnit.net 00:00:02.05] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.05] Stack Trace:
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.05] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.05] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.05] Check that GET Device State returns error response when wrong device id [FAIL]
[xUnit.net 00:00:02.05] Reqnroll.BoDi.ObjectContainerException : Concurrent object resolution timeout (potential circular dependency).
[xUnit.net 00:00:02.05] Stack Trace:
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath, TimeSpan timeout)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.FactoryRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve(Type typeToResolve, String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T](String name)
[xUnit.net 00:00:02.05] at Reqnroll.BoDi.ObjectContainer.Resolve[T]()
[xUnit.net 00:00:02.05] at Reqnroll.Microsoft.Extensions.DependencyInjection.DependencyInjectionPlugin.CustomizeFeatureDependenciesEventHandler(Object sender, CustomizeFeatureDependenciesEventArgs args)
[xUnit.net 00:00:02.05] at Reqnroll.Plugins.RuntimePluginEvents.RaiseCustomizeFeatureDependencies(ObjectContainer featureContainer)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContainerBuilder.CreateFeatureContainer(IObjectContainer testThreadContainer, FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.ContextManager.InitializeFeatureContext(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Reqnroll.TestRunner.OnFeatureStartAsync(FeatureInfo featureInfo)
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureSetupAsync()
[xUnit.net 00:00:02.05] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.InitializeAsync()
[xUnit.net 00:00:02.06] [Test Class Cleanup Failure (Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature)] System.NullReferenceException
[xUnit.net 00:00:02.06] System.NullReferenceException : Object reference not set to an instance of an object.
[xUnit.net 00:00:02.06] Stack Trace:
[xUnit.net 00:00:02.06] at Reqnroll.Infrastructure.TestExecutionEngine.GetHookContainer(HookType hookType)
[xUnit.net 00:00:02.06] at Reqnroll.Infrastructure.TestExecutionEngine.FireRuntimePluginTestExecutionLifecycleEvents(HookType hookType)
[xUnit.net 00:00:02.06] at Reqnroll.Infrastructure.TestExecutionEngine.FireEventsAsync(HookType hookType)
[xUnit.net 00:00:02.06] at Reqnroll.Infrastructure.TestExecutionEngine.OnFeatureEndAsync()
[xUnit.net 00:00:02.06] at Reqnroll.TestRunner.OnFeatureEndAsync()
[xUnit.net 00:00:02.06] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FeatureTearDownAsync()
[xUnit.net 00:00:02.06] at Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests.Features.DeviceSettingsAndStateTestsFeature.FixtureData.Xunit.IAsyncLifetime.DisposeAsync()
======== BeforeFeature
======== AfterFeature
================ AfterTestRun
-> warning: Found 1 not released TestRunners (ids: 2)
[xUnit.net 00:02:26.08] Finished: Eneco.Vpp.BehindTheMeter.Hems.e2e.Tests
========== Test run finished: 24 Tests (8 Passed, 16 Failed, 0 Skipped) run in 2,4 min ==========
Steps to Reproduce
When two feature files are executed or more then One of them is being executed and all other features are failied almost imideate.
Link to Repro Project
No response
Most probably the issue is related to the Reqnroll.Microsoft.Extensions.DependencyInjection plugin and not to the core Reqnroll. But it's a good question still why it produces this error.
Could you please share a bit more information about the situation?
- Why do you need the timeout setting? Is there any resource that resolves slowly?
- What happens if you remove the timeout setting?
- What happens if you increase the timeout setting?
- Could you please confirm that you don't use test-level parallelization (could you please share the parallel settings)?
- Is it possible that you really have a circular dependency (that was somehow ignored by SpecFlow)?
- Can you reproduce this if you disable parallel execution?
- Can you reproduce it with the debugger attached (so that you can better see what is happening when the exception comes)?
@padnevici Do you have any feedback on this?
Hello,
Sorry for the late reply. I had to switch back to specflow due to a parallel execution issue and long response on the issue. I cannot recreate the issue now, cause I have a different unit test library.
- Why do you need the timeout setting? Is there any resource that resolves slowly?
Yes, slow resources, but test were failing immediately
- What happens if you remove the timeout setting?
Did not try, and I cannot try it now
- What happens if you increase the timeout setting?
No change, tests were failing the same way, one feature was executing other were failing immediate
- Could you please confirm that you don't use test-level parallelization (could you please share the parallel settings)?
Not sure, but I did not play with additional settings. I simply migrated from specflow to reqnroll. On specflow the parallelization was per feature. Feature files were executed in parallel.
- Is it possible that you really have a circular dependency (that was somehow ignored by SpecFlow)?
Not sure and I cannot check it now
- Can you reproduce this if you disable parallel execution?
Did not try. But I could execute all feature files one by one in debug mode. Debug mode in Rider disables parallelisation.
- Can you reproduce it with the debugger attached (so that you can better see what is happening when the exception comes)?
No, I could not. Parallelisation is disabled in debug mode
Best regards, Andrei
пн, 14 окт. 2024 г. в 16:48, Gáspár Nagy @.***>:
@padnevici https://github.com/padnevici Do you have any feedback on this?
— Reply to this email directly, view it on GitHub https://github.com/reqnroll/Reqnroll/issues/263#issuecomment-2411483201, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXYP5YCCBSANEXLXNTDXW3Z3PKVHAVCNFSM6AAAAABOQOGONSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJRGQ4DGMRQGE . You are receiving this because you were mentioned.Message ID: @.***>
Thx for the answers. I would suggest closing this issue until you (or someone) get into the position of reproducing this issue again.
So if there is any update, feel free to reopen it.
I had this issue. I fixed it, in my case, by moving the building of a static ServiceCollection to a BeforeTestRun hook and simply returning the built static ServiceCollection in the ScenarioDependencies attributed static method.
private static readonly ServiceCollection _serviceCollection;
static Config()
{
_serviceCollection = new ServiceCollection();
}
[BeforeTestRun(Order = 0)]
public static async Task BeforeTestRun()
{
Register(_serviceCollection);
}
[ScenarioDependencies]
public static IServiceCollection CreateServices()
{
return _serviceCollection;
}