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

Error during binding discovery - Cannot find reference assembly 'System.Runtime.Intrinsics.dll' file

Open Naweap opened this issue 3 years ago • 3 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

None

Issue Description

I'm using SpecFlow version 3.9.74 on a .NET 5 test project with Visual Studio 2022.

I also got the package SpecFlow.NUnit version 3.9.74 and the SpecFlow extension for Visual Studio 2022.

Everything went fine until now. After building my test project, I recently got the error message below :

Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: C:\dev\src\xxx\xxx\bin\Debug\net5.0> C:\Program Files\dotnet\dotnet.exe exec C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\17.0_1213a7dc\Extensions\rbcb3gxv.t4x\Connectors\Generic-net6.0\specflow-vs.dll discovery C:\dev\src\xxx\xxx\bin\Debug\net5.0\xxx.dll "" Exit code: 4 Message: System.InvalidOperationException: Cannot find reference assembly 'System.Runtime.Intrinsics.dll' file for package System.Runtime.Intrinsics at Microsoft.Extensions.DependencyModel.Resolution.ReferenceAssemblyPathResolver.TryResolveAssemblyPaths(CompilationLibrary library, List 1 assemblies) at SpecFlowConnector.AssemblyLoading.RuntimeCompositeCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List 1 assemblies) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\AssemblyLoading\RuntimeCompositeCompilationAssemblyResolver.cs:line 19 System.InvalidOperationException: Cannot find reference assembly 'System.Core.dll' file for package System.Core at Microsoft.Extensions.DependencyModel.Resolution.ReferenceAssemblyPathResolver.TryResolveAssemblyPaths(CompilationLibrary library, List 1 assemblies) at SpecFlowConnector.AssemblyLoading.RuntimeCompositeCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List 1 assemblies) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\AssemblyLoading\RuntimeCompositeCompilationAssemblyResolver.cs:line 19 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.ReadOnlySpan 1<Char> System.MemoryExtensions.AsSpan(System.String)'. at System.Text.Json.JsonCamelCaseNamingPolicy.<>c.<ConvertName>b__0_0(Span1 chars, String name) at System.String.Create[TState](Int32 length, TState state, SpanAction2 action) at System.Text.Json.JsonCamelCaseNamingPolicy.ConvertName(String name) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.DeterminePropertyName() at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.GetPolicies(Nullable1 ignoreCondition, Nullable1 declaringTypeNumberHandling) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.Initialize(Type parentClassType, Type declaredPropertyType, Type runtimePropertyType, ConverterStrategy runtimeClassType, MemberInfo memberInfo, Boolean isVirtual, JsonConverter converter, Nullable1 ignoreCondition, Nullable1 parentTypeNumberHandling, JsonSerializerOptions options) at System.Text.Json.Serialization.Metadata.JsonTypeInfo.CreateProperty(Type declaredPropertyType, Type runtimePropertyType, MemberInfo memberInfo, Type parentClassType, Boolean isVirtual, JsonConverter converter, JsonSerializerOptions options, Nullable1 parentTypeNumberHandling, Nullable1 ignoreCondition) at System.Text.Json.Serialization.Metadata.JsonTypeInfo.AddProperty(MemberInfo memberInfo, Type memberType, Type parentClassType, Boolean isVirtual, Nullable1 parentTypeNumberHandling, JsonSerializerOptions options) at System.Text.Json.Serialization.Metadata.JsonTypeInfo..ctor(Type type, JsonConverter converter, Type runtimeType, JsonSerializerOptions options) at System.Text.Json.Serialization.Metadata.JsonTypeInfo..ctor(Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializerOptions.<InitializeForReflectionSerializer>g__CreateJsonTypeInfo|112_0(Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializerOptions.GetClassFromContextOrCreate(Type type) at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type type) at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type runtimeType) at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options) at SpecFlowConnector.JsonSerialization.SerializeObject(Object obj) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\JsonSerialization.cs:line 15 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.ReflectionExecutor.Execute(String optionsJson, Assembly testAssembly, AssemblyLoadContext assemblyLoadContext, IDictionary2 analyticsProperties) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 67 --- 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.ReflectionExecutor.<>c__DisplayClass0_0.<Execute>b__2(Object instance) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\ReflectionExecutor.cs:line 23 at Some1.Map[TResult](Func2 map) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\NetExtensions\Optional\Some.cs:line 26 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 21 at SpecFlowConnector.Runner.ExecuteDiscovery(DiscoveryOptions options, Func3 testAssemblyFactory) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Runner.cs:line 44 at SpecFlowConnector.Runner.<>c__DisplayClass4_0.<Run>b__0(ConnectorOptions options) in D:\a\1\s\Connectors\SpecFlow.VisualStudio.SpecFlowConnector.Generic\Runner.cs:line 29 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, Func2 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.

And as expected by the message at the end of the trace, navigation does not work on steps. This is really annoying.

I got another .NET Standard test project where everything works fine. However I followed the same procedure to set it up.

Thanks in advance for your support.

Steps to Reproduce

None

Link to Repository Project

No response

Naweap avatar Aug 31 '22 18:08 Naweap

I have the same issue. I have two test projects in my solution. For one of them the SpecFlow extension works normally, and for the other one I can't reach the definition from the ".feature" files, although it's exactly the same configuration for both projects.

RaedAbr avatar Sep 05 '22 11:09 RaedAbr

I'm having the same issue. Visual Studio 2022, .Net6. Had a .Net6 project working fine, then added another and it broke the binding between the steps of both projects.

davidhowesuk avatar Oct 24 '22 16:10 davidhowesuk

Had the same problem. Upgraded autotest project to .NET 6 and problem is gone.

Evgeniy-Pol avatar Apr 06 '23 17:04 Evgeniy-Pol