SpecFlow.VS icon indicating copy to clipboard operation
SpecFlow.VS copied to clipboard

Step navigation stopped working when updated to .NET 8

Open marcel-tatasteel opened this issue 2 years ago • 10 comments

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

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

{ "language": { "feature": "en-US" }, }

Issue Description

Info: OnActivityStarted: Starting Visual Studio Extension... Info: CreateProjectScope: Initializing project: Snail.Sl21.FunctionalTests Info: OnSettingsInitialized: Project settings initialized: .NETCoreApp,Version=v8.0,SpecFlow:3.9.74 Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: D:\Projects\Snail\src\Sl21\Snail.Sl21.FunctionalTests\bin\Debug\net8.0> C:\Program Files\dotnet\dotnet.exe exec C:\Users\adfd\AppData\Local\Microsoft\VisualStudio\17.0_94496f41\Extensions\in1cwrje.ezc\Connectors\Generic-net7.0\specflow-vs.dll discovery D:\Projects\Snail\src\Sl21\Snail.Sl21.FunctionalTests\bin\Debug\net8.0\Snail.Sl21.FunctionalTests.dll D:\Projects\Snail\src\Sl21\Snail.Sl21.FunctionalTests\specflow.json Exit code: 4 Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Het systeem kan het opgegeven bestand niet vinden. File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.ModuleHandle.ResolveMethod(QCallModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount) at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, ReadOnlySpan1 typeInstantiationContext, ReadOnlySpan1 methodInstantiationContext) at System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.RuntimeType.GetMethodBase(RuntimeModule scope, Int32 typeMetadataToken) at System.Reflection.RuntimeCustomAttributeData..ctor(RuntimeModule scope, MetadataToken caCtorToken, ConstArray& blob) at System.Reflection.RuntimeCustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget) at SpecFlowConnector.ReflectionExecutor.Execute(DiscoveryOptions options, Func3 testAssemblyFactory, ILogger _log, IAnalyticsContainer analytics) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 15 at SpecFlowConnector.Runner.ExecuteDiscovery(DiscoveryOptions options, Func3 testAssemblyFactory) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Runner.cs:line 50 at SpecFlowConnector.Runner.<>c__DisplayClass4_0.<Run>b__0(ConnectorOptions options) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Runner.cs:line 30 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.Runner.Run(String[] args, Func3 testAssemblyFactory) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Runner.cs:line 26 Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: D. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at SpecFlow.VisualStudio.Connectors.OutProcSpecFlowConnector.Deserialize(RunProcessResult result, Func`2 formatErrorMessage) 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

Update to .NET 8

Link to Repository Project

No response

marcel-tatasteel avatar Nov 17 '23 10:11 marcel-tatasteel

I temporarily changed the target framework of the specs to .NET 7.0 and then switched back to .NET 8.0 and the steps were bind again.

mardsystems avatar Nov 18 '23 17:11 mardsystems

I temporarily changed the target framework of the specs to .NET 7.0 and then switched back to .NET 8.0 and the steps were bind again.

I created a PR to fix this permanently. Thanks for the tip!

marcel-tatasteel avatar Nov 19 '23 10:11 marcel-tatasteel

Please note that generating steps is also no longer possible when using dotnet 8.

robbaman avatar Nov 22 '23 07:11 robbaman

@robbaman Works again after .Net 8 update is released.

marcel-tatasteel avatar Nov 28 '23 12:11 marcel-tatasteel

@marcel-tatasteel Thanks for the update. Is this update expected soon(ish)? I noticed there's a PR for this, but I'm not sure what release schedule you follow.

Not that we're in an immediate rush, but I'm just curious :)

robbaman avatar Nov 28 '23 12:11 robbaman

@robbaman The PR is just merged with the main branch, not sure when the release is update. In the mean time you could use the vsix artifact that was released => Azure DevOps ( it's the same as what's going to be released )

marcel-tatasteel avatar Nov 28 '23 13:11 marcel-tatasteel

Until it will be published to the marketplace, you can install this version from the VSIX file attached to the release: https://github.com/SpecFlowOSS/SpecFlow.VS/releases/tag/v2022.1.93-net8

gasparnagy avatar Nov 29 '23 08:11 gasparnagy

Hi @gasparnagy

Any news on when the .NET 8 fix will be published to the market place?

sammeel avatar Jan 18 '24 07:01 sammeel

Any news on when the .NET 8 fix will be published to the market place?

I keep trying to find a solution for this. Please stay tuned. I hope to have something next week.

gasparnagy avatar Jan 18 '24 08:01 gasparnagy

SpecFlow has been forked and rebooted in a new name: Reqnroll. The Reqnroll Visual Studio extension works with SpecFlow projects as well and contains the .NET 8.0 support. See public announcement of Reqnroll and the Reqnroll Visual Studio extension release details.

gasparnagy avatar Feb 08 '24 14:02 gasparnagy