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 - when using System.Windows.Media.Media3D in step files #100

Open cyclingJW opened 2 years ago

cyclingJW commented 2 years ago

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

SpecFlow Section in app.config or content of specflow.json

No response

Issue Description

Whenever use Point3D or Visual3D in SpecFlow step files, the step binding will break, and you can't navigate to steps from the feature file.

I do've other project where the binding works fine, and they don't use Media3D. It would be great if you could do some investigation about it, because it's a bit annoying not to have the steps binding.

SpecFlow for Visual Studio 2022 Version: 2022.1.75.53377

In our case we get the following error:

Info: OnActivityStarted: Starting Visual Studio Extension... Info: CreateProjectScope: Initializing project: TestExperiment.AcceptanceTests Info: OnSettingsInitialized: Project settings initialized: .NETCoreApp,Version=v6.0,SpecFlow:3.9.40 Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: C:\Users\WaelJoe1\Downloads\TestExperiment\TestExperiment\TestExperiment.AcceptanceTests\bin\Debug\net6.0-windows> C:\Program Files\dotnet\dotnet.exe exec C:\Users\WaelJoe1\AppData\Local\Microsoft\VisualStudio\17.0_4abef084\Extensions\vogxncq5.0uk\Connectors\Generic-net6.0\specflow-vs.dll discovery C:\Users\WaelJoe1\Downloads\TestExperiment\TestExperiment\TestExperiment.AcceptanceTests\bin\Debug\net6.0-windows\TestExperiment.AcceptanceTests.dll "" Exit code: 0 Message: Info Found V3.9.40.46609 at C:\Users\WaelJoe1\Downloads\TestExperiment\TestExperiment\TestExperiment.AcceptanceTests\bin\Debug\net6.0-windows\TechTalk.SpecFlow.dll Info Chosen BindingRegistryFactoryBeforeV310000 for 309040 Error System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load file or assembly 'PresentationCore, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. 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(IEnumerable1 bindingAssemblies) at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner) at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId) System.IO.FileNotFoundException: Could not load file or assembly 'PresentationCore, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. File name: 'PresentationCore, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Span1& 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 SpecFlowConnector.ReflectionExtensions.ReflectionCallMethod[T](Object obj, String methodName, Type[] parameterTypes, Object[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\ReflectionExtensions.cs:line 26 at SpecFlowConnector.ReflectionExtensions.ReflectionCallMethod[T](Object obj, String methodName, Object[] args) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\ReflectionExtensions.cs:line 7 at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryBeforeV310000.InvokeCreateTestRunner(TestRunnerManager testRunnerManager) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactoryBeforeV310000.cs:line 13 at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateTestRunner(IObjectContainer globalContainer, Assembly testAssembly) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactoryVLatest.cs:line 62 at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateTestRunner(Object globalContainer, Assembly testAssembly) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactoryVLatest.cs:line 55 at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.<>cDisplayClass2_0.b2(Object container) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactory.cs:line 26 at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\FunctionalExtensions.cs:line 5 at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.<>cDisplayClass2_0.b0(Object dependencyProvider) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\SpecFlowProxies\BindingRegistryFactory.cs:line 17 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.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.<>cDisplayClass3_0.b5(DiscoveryCommand cmd) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 71 at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\FunctionalExtensions.cs:line 5 at SpecFlowConnector.ReflectionExecutor.<>cDisplayClass3_1.b1() in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 69 at EitherAdapters.Try[T](Func`1 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 zip attached is a small project which causes the bug. Best is to close Visual Studio every time you change something, because sometimes it does like "caching" the binding so the real effect so see only if you start Visual Studio and open the solution and build it again

  1. You can already build the solution from the zip, and you get the error and the binding not working. In the step file VisualsStepDefinitions the class wide variable _startPoint causes the break binding.

  2. Use instead of a class wide variable local variable inside the step and the binding will not break. method GivenANewPipeWithStartPoint and declare a variable var startPoint = new Point3D(p0, p1, p2)

TestExperiment.zip

Link to Repository Project

No response