solidtoken / SpecFlow.DependencyInjection

SpecFlow plugin that enables to use Microsoft.Extensions.DependencyInjection for resolving test dependencies.
BSD 3-Clause "New" or "Revised" License
35 stars 11 forks source link

MissingMethodException on SpecFlow 3.7.13 #38

Closed xsoheilalizadeh closed 3 years ago

xsoheilalizadeh commented 3 years ago

When I want to use this package with SpecFlow 3.7.13 there would a problem regarding finding a method in BoDi. There're not any problems with previous version of Specflow because they use BoDi 1.4.1 but SpecFlow 3.7.13 use BoDi 1.15.

  Message: 
    System.AggregateException : One or more errors occurred. (Method not found: 'Void BoDi.ObjectContainer.RegisterTypeAs(System.String)'.) (Method not found: 'Void BoDi.ObjectContainer.RegisterTypeAs(System.String)'.) (The following constructor parameters did not have matching fixture data: FixtureData fixtureData, SolidToken_SpecFlow_DependencyInjection_Tests_XUnitAssemblyFixture assemblyFixture)
    ---- System.MissingMethodException : Method not found: 'Void BoDi.ObjectContainer.RegisterTypeAs(System.String)'.
    ---- System.MissingMethodException : Method not found: 'Void BoDi.ObjectContainer.RegisterTypeAs(System.String)'.
    ---- The following constructor parameters did not have matching fixture data: FixtureData fixtureData, SolidToken_SpecFlow_DependencyInjection_Tests_XUnitAssemblyFixture assemblyFixture
  Stack Trace: 
    ----- Inner Stack Trace #1 (System.MissingMethodException) -----
    DependencyInjectionPlugin.<Initialize>b__1_0(Object sender, CustomizeGlobalDependenciesEventArgs args)
    RuntimePluginEvents.RaiseCustomizeGlobalDependencies(ObjectContainer container, SpecFlowConfiguration specFlowConfiguration)
    ContainerBuilder.CreateGlobalContainer(Assembly testAssembly, IRuntimeConfigurationProvider configurationProvider)
    TestRunnerManager.CreateTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder)
    TestRunnerManager.GetTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder, Boolean createIfMissing)
    TestRunnerManager.OnTestRunStart(Assembly testAssembly, IContainerBuilder containerBuilder)
    SolidToken_SpecFlow_DependencyInjection_Tests_XUnitAssemblyFixture.ctor() line 19
    ----- Inner Stack Trace #2 (System.MissingMethodException) -----
    DependencyInjectionPlugin.<Initialize>b__1_0(Object sender, CustomizeGlobalDependenciesEventArgs args)
    RuntimePluginEvents.RaiseCustomizeGlobalDependencies(ObjectContainer container, SpecFlowConfiguration specFlowConfiguration)
    ContainerBuilder.CreateGlobalContainer(Assembly testAssembly, IRuntimeConfigurationProvider configurationProvider)
    TestRunnerManager.CreateTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder)
    TestRunnerManager.GetTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder, Boolean createIfMissing)
    TestRunnerManager.GetTestRunner(Assembly testAssembly, Nullable`1 managedThreadId, IContainerBuilder containerBuilder)
    ContextInjectionScopeFeature.FeatureSetup()
    FixtureData.ctor()
    ----- Inner Stack Trace #3 (Xunit.Sdk.TestClassException) -----

cc @mbhoek

mbhoek commented 3 years ago

Thank you for your report 👍. I'm going to guess here and say this might be a duplicate of #37. There is some information in that issue that might help you going until I release a new version of the package.

mbhoek commented 3 years ago

@xsoheilalizadeh Please let me know if the latest version solves your problem. Thanks!