The type initializer for 'AutoTests.Framework.Logging.Log' threw an exception.
Used Visual Studio
Visual Studio 2022
Are the latest Visual Studio updates installed?
Yes
SpecFlow Section in app.config or content of specflow.json
<runtime stopAtFirstError="true" missingOrPendingStepsOutcome="Error" />
</specFlow>
<add key="FunctionsType" value="AutoTests.ProjectSpecificCommons.Transformations.Tokens.Functions, AutoTests.ProjectSpecificCommons" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<dependentAssembly>
<assemblyIdentity name="TechTalk.SpecFlow.Generator" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="TechTalk.SpecFlow.Parser" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="TechTalk.SpecFlow.Utils" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="TechTalk.SpecFlow" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="2638cd05610744eb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.13.1.0" newVersion="3.13.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
Issue Description
Info: OnActivityStarted: Starting Visual Studio Extension...
Info: CreateProjectScope: Initializing project: AutoTests.Specs
Info: OnSettingsInitialized: Project settings initialized: .NETFramework,Version=v4.8,SpecFlow:3.9.74
Warning: AndDiscoveryProviderSucceed: Error during binding discovery.
Command executed:
C:\TestAutomation\Automation5.1\AutoTests.Specs\bin\Debug> C:\Program Files\dotnet\dotnet.exe exec C:\Users<user>\AppData\Local\Microsoft\VisualStudio\17.0_53419117\Extensions\wh4q3a5i.sy3\Connectors\Generic-net6.0\specflow-vs.dll discovery C:\TestAutomation\Automation5.1\AutoTests.Specs\bin\Debug\AutoTests.Specs.dll C:\TestAutomation\Automation5.1\AutoTests.Specs\App.config
Exit code: 0
Message:
Info Found V3.9.74.14555 at C:\TestAutomation\Automation5.1\AutoTests.Specs\bin\Debug\TechTalk.SpecFlow.dll
Info Chosen BindingRegistryFactoryBeforeV310000 for 309074
Error System.TypeInitializationException: The type initializer for 'AutoTests.Framework.Logging.Log' threw an exception.
---> System.MissingMethodException: Method not found: 'System.String System.AppDomainSetup.get_ConfigurationFile()'.
at NLog.Internal.Fakeables.AppDomainWrapper..ctor(AppDomain appDomain)
at NLog.Internal.Fakeables.AppDomainWrapper.get_CurrentDomain()
at NLog.LogFactory.get_CurrentAppDomain()
at NLog.LogFactory.2 fn) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\FunctionalExtensions.cs:line 5
at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.GetBindingRegistry(AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option1 configFile) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactory.cs:line 16
at SpecFlowConnector.Discovery.SpecFlowDiscoverer.Discover(IBindingRegistryFactory bindingRegistryFactory, AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option1 configFile) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Discovery\SpecFlowDiscoverer.cs:line 24
at SpecFlowConnector.Discovery.DiscoveryCommand.<>c__DisplayClass6_0.<Execute>b__0(IBindingRegistryFactory bindingRegistryFactory) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Discovery\DiscoveryCommand.cs:line 27
at FunctionalExtensions.Map[TSource,TResult](TSource this, Func2 fn) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\FunctionalExtensions.cs:line 5
at SpecFlowConnector.Discovery.DiscoveryCommand.Execute(AssemblyLoadContext assemblyLoadContext) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Discovery\DiscoveryCommand.cs:line 25
at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_0.2 fn) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\FunctionalExtensions.cs:line 5
at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_1.<Execute>b__1() in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 69
at EitherAdapters.Try[T](Func1 act) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\Either\EitherAdapters.cs:line 40
Warning: AndDiscoveryProviderSucceed: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled.
Please check the error message above and report to https://github.com/SpecFlowOSS/SpecFlow.VS/issues if you cannot fix.
Steps to Reproduce
The issue occurs while building using VS 2022.
Link to Repository Project
No response