SpecFlowOSS / SpecFlow.VS

The next version of the Visual Studio extension for SpecFlow
MIT License
39 stars 12 forks source link

Error during binding discovery #61

Open sauravkumarsahoo opened 2 years ago

sauravkumarsahoo commented 2 years ago

SpecFlow Extension: SpecFlow for Visual Studio 2022 version 2021.4.5.18546 SpecFlow NuGet Version: 3.9.40 Project Dotnet Version: 5 DotNet Info:

.NET SDK (reflecting any global.json):
 Version:   6.0.101
 Commit:    ef49f6213a

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support):
  Version: 6.0.1
  Commit:  3a25a7f1cc

.NET SDKs installed:
  1.1.14 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.526 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  3.1.120 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.301 [C:\Program Files\dotnet\sdk]
  3.1.415 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.403 [C:\Program Files\dotnet\sdk]
  6.0.101 [C:\Program Files\dotnet\sdk]

specflow.json

{
  "bindingCulture": {
    "language": "en-us"
  },
  "language": {
    "feature": "en-us"
  },
  "stepAssemblies": [
    {
      "assembly": "<NamespaceOfAssembly>"
    }
  ]
}

NamespaceOfAssembly has the name of the actual assembly.

Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: C:\Users\user\source\repos\testautomation\Tests\Regression\bin\Debug\net5.0> C:\Program Files\dotnet\dotnet.exe exec c:\users\user\appdata\local\microsoft\visualstudio\17.0_1dc4e21b\extensions\524bqjox.54w\Connectors\V3-net6.0\specflow-vs.dll discovery C:\Users\user\source\repos\testautomation\Tests\Regression\bin\Debug\net5.0\Regression.dll C:\Users\user\source\repos\testautomation\Tests\Regression\specflow.json Exit code: 4 Message: Exception in:SpecFlow.VisualStudio.SpecFlowConnector.Discovery.V38.SpecFlowV38Discoverer Error: Exception has been thrown by the target of an invocation. -> Unable to load one or more of the requested types. Could not load type 'Microsoft.Extensions.Hosting.IHostApplicationLifetime' from assembly 'Microsoft.Extensions.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Exception: System.Reflection.TargetInvocationException->System.Reflection.ReflectionTypeLoadException

StackTrace:
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly)
   at TechTalk.SpecFlow.TestRunnerManager.BuildBindingRegistry(IEnumerable`1 bindingAssemblies)
   at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner)
   at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId)
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.SpecFlowV3BaseDiscoverer.GetBindingRegistry(Assembly testAssembly, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\SpecFlowV3BaseDiscoverer.cs:line 20
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.BaseDiscoverer.DiscoverInternal(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\Discovery\BaseDiscoverer.cs:line 14
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.BaseDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\Discovery\BaseDiscoverer.cs:line 58
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.VersionSelectorDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\VersionSelectorDiscoverer.cs:line 21
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at SpecFlow.VisualStudio.SpecFlowConnector.ReflectionExtensions.ReflectionCallMethod[T](Object obj, String methodName, Type[] parameterTypes, Object[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\ReflectionExtensions.cs:line 30
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.ReflectionSpecFlowDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\ReflectionSpecFlowDiscoverer.cs:line 18
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.DiscoveryProcessor.Process() in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V2\Discovery\DiscoveryProcessor.cs:line 24
   at SpecFlow.VisualStudio.SpecFlowConnector.DiscoveryCommand.Execute(String[] commandArgs) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\DiscoveryCommand.cs:line 14
   at SpecFlow.VisualStudio.SpecFlowConnector.ConsoleRunner.EntryPoint(String[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\ConsoleRunner.cs:line 22

Warning: AndDiscoveryProviderSucceed: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled.

Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: C:\Users\G86484\source\repos\testautomation\suwp-testautomation-iquote\Tests\Regression\bin\Debug\net5.0> C:\Program Files\dotnet\dotnet.exe exec c:\users\g86484\appdata\local\microsoft\visualstudio\17.0_1dc4e21b\extensions\524bqjox.54w\Connectors\V3-net6.0\specflow-vs.dll discovery C:\Users\G86484\source\repos\testautomation\Tests\Regression\bin\Debug\net5.0\Regression.dll C:\Users\G86484\source\repos\testautomation\Tests\Regression\specflow.json Exit code: 4 Message: Exception in:SpecFlow.VisualStudio.SpecFlowConnector.Discovery.V38.SpecFlowV38Discoverer Error: Exception has been thrown by the target of an invocation. -> Unable to load one or more of the requested types. Could not load type 'Microsoft.Extensions.Hosting.IHostApplicationLifetime' from assembly 'Microsoft.Extensions.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Exception: System.Reflection.TargetInvocationException->System.Reflection.ReflectionTypeLoadException

StackTrace:
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly)
   at TechTalk.SpecFlow.TestRunnerManager.BuildBindingRegistry(IEnumerable`1 bindingAssemblies)
   at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner)
   at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId)
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.SpecFlowV3BaseDiscoverer.GetBindingRegistry(Assembly testAssembly, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\SpecFlowV3BaseDiscoverer.cs:line 20
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.BaseDiscoverer.DiscoverInternal(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\Discovery\BaseDiscoverer.cs:line 14
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.BaseDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\Discovery\BaseDiscoverer.cs:line 58
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.VersionSelectorDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\VersionSelectorDiscoverer.cs:line 21
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at SpecFlow.VisualStudio.SpecFlowConnector.ReflectionExtensions.ReflectionCallMethod[T](Object obj, String methodName, Type[] parameterTypes, Object[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\ReflectionExtensions.cs:line 30
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.ReflectionSpecFlowDiscoverer.Discover(Assembly testAssembly, String testAssemblyPath, String configFilePath) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V3\Discovery\ReflectionSpecFlowDiscoverer.cs:line 18
   at SpecFlow.VisualStudio.SpecFlowConnector.Discovery.DiscoveryProcessor.Process() in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.V2\Discovery\DiscoveryProcessor.cs:line 24
   at SpecFlow.VisualStudio.SpecFlowConnector.DiscoveryCommand.Execute(String[] commandArgs) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\DiscoveryCommand.cs:line 14
   at SpecFlow.VisualStudio.SpecFlowConnector.ConsoleRunner.EntryPoint(String[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector\ConsoleRunner.cs:line 22

Warning: AndDiscoveryProviderSucceed: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled.

Klarahov commented 2 years ago

My SpecFlow project runs green in VS 2019, but in VS 2022 I have the same issue. I manually installed older SpecFlow versions but that didn't solve it for me.

patiqs commented 2 years ago

I plan to fix this in the next release. Please help me to reproduce this issue locally on my laptop. The best would be if you can create and share a repo where the issue exists. Or I can give you write access to our investigation repo, where you can commit a sample. If this doesn't work, then I need the csproj content of your test project

Klarahov commented 2 years ago

Great, thanks! For me it was enough to build the project and open a feature file, to see the error. Here is a simple example where it was enough doing this: https://github.com/klarahovstadius/TestAutomationCsharp/tree/master/TestAutomation

shilamontubig commented 2 years ago

Is there any update regarding this issue? I am also experiencing this problem in my project.

patiqs commented 2 years ago

In the past few weeks I have worked on a refactored connector. We want to publish it in the upcomming weeks, but here is a beta version if you want to test: https://github.com/SpecFlowOSS/Investigation/blob/main/SpecFlow.VisualStudio.Package.vsix

isherkhan commented 7 months ago

HI

Any Updates on the Above issue.