SpecFlowOSS / SpecFlow.VS

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

Step navigation stopped working when updated to .NET 8 #145

Open marcel-tatasteel opened 8 months ago

marcel-tatasteel commented 8 months 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

{ "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.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

mardsystems commented 8 months ago

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.

marcel-tatasteel commented 8 months ago

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!

robbaman commented 8 months ago

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

marcel-tatasteel commented 8 months ago

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

robbaman commented 8 months ago

@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 :)

marcel-tatasteel commented 8 months ago

@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 )

gasparnagy commented 8 months ago

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

sammeel commented 6 months ago

Hi @gasparnagy

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

gasparnagy commented 6 months ago

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 commented 5 months ago

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.