Specflow: .Net Core 3.0.100-preview7-012821

Created on 25 Jul 2019  Â·  13Comments  Â·  Source: SpecFlowOSS/SpecFlow


Error upgrading to .Net Core 3.0.100-preview7-012821

SpecFlow Version:

  • [x] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Used Test Runner

  • [ ] SpecFlow+Runner
  • [ ] MSTest
  • [ ] NUnit
  • [x] Xunit


Version number:

Project Format of the SpecFlow project

  • [ ] Classic project format using packages.config
  • [x] Classic project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

  • [x] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [ ] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [x] VS 2019
  • [ ] VS 2017
  • [ ] VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • [x] Enabled
  • [ ] Disabled

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No, I use Visual Studio version <Major>.<Minor>.<Patch>

.NET Framework:

  • [ ] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [ ] .NET Core 2.2
  • [x] .NET Core 3.0

Test Execution Method:

  • [x] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [x] Command line – dotnet test

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


Repro Project


The Ray Tracer Challenge

Issue Description

Test fail with the error message below after upgrading .Net Core 3.0 from 3.0.100-preview6-012264 to 3.0.100-preview7-012821.

Mitigate the issue by adding global.json with SDK version to 3.0.100-preview6-012264 and the test will pass. Changing the SDK verison to 3.0.100-preview7-012821 the test will fail.

  Error Message:
   System.AggregateException : One or more errors occurred. (Value cannot be null. (Parameter 'key')) (The following constructor parameters did not have matching fixture data: FixtureData fixtureData)
---- System.ArgumentNullException : Value cannot be null. (Parameter 'key')
---- The following constructor parameters did not have matching fixture data: FixtureData fixtureData
  Stack Trace:

----- Inner Stack Trace #1 (System.ArgumentNullException) -----
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.FindAttributeConstructorArg(ParameterInfo parameterInfo, Dictionary`2 namedAttributeValues)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.<>c__DisplayClass8_0.<CreateAttribute>b__7(ParameterInfo p)
   at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.CreateAttribute(Attribute attribute)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.GetAttributes(IEnumerable`1 customAttributes)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.CreateBindingSourceMethod(MethodInfo methodDefinition)
   at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromType(Type type)
   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 TechTalk.SpecFlow.TestRunnerManager.GetTestRunnerWithoutExceptionHandling(Int32 threadId)
   at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Int32 threadId)
   at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Nullable`1 managedThreadId)
   at StealthTech.RayTracer.Specs.LightsFeature.FeatureSetup()
   at StealthTech.RayTracer.Specs.LightsFeature.FixtureData..ctor()
----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----

Steps to Reproduce

Runtime SpecFlow Team Backlog

Most helpful comment

I tested again with .NET Core SDK 3.0.100-preview7-012821 and Specflow 3.1.21-beta and it's all working fine.
Thanks @SabotageAndi

All 13 comments

Interesting behavior. Thanks for the headsup.
We are planning to add testing for .NET Core 3.0 in our next sprint.

Your welcome, I know this could be a finger pointing issue, but I figured to start here and if this is an issue with .Net Core 3.0.100-preview7-012821 ya'll would have a better chance with presenting the issue to Microsoft than I would. I checked API diff and there was a change with Dictionary but nothing stood out as something that would cause an issue. But I'm just grasping at straws.

I have the same error as well. No matter how I change the Specflow version in net core preview 7, it will always show me the same error.

I don't have this error in preview 6. BTW, I also upgrade the vs to vs 2019 16.3 preview 1, not sure whether it will cause the issue.

I eliminated Visual Studio from the equation by running the tests from the command prompt. I ran dotnet test and received the errors when using preview 7, switched back to preview 6, ran the test and I did not receive the errors.

I confirm @y2k4life problem.
I'm having the same issue after I've upgraded .NET Core SDK to 3.0.100-preview7-012821 version.
Worked fine on preview 6.
Tried dotnet test from console and I'm getting the same error.

Same here

I have investigated the issue. Looks like the problem is here: https://github.com/techtalk/SpecFlow/blob/master/TechTalk.SpecFlow/Bindings/Discovery/RuntimeBindingRegistryBuilder.cs#L113.
paramName is null here for NullableContext ctor of object.GetType method and probably for some other parameters.

@david1995 is working on it right now. Looks like the reason are the new attributes, that are added because of nullable reference types.
Our reflection code now finds attributes where it didn't find any before.

Don't sure, but it can be a fix: https://github.com/techtalk/SpecFlow/pull/1687

NuGet packages are getting uploaded at the moment. Version 3.1.21-beta should fix this issue. Please open new issue if you all have still problems with .NET Core 3.

I tested again with .NET Core SDK 3.0.100-preview7-012821 and Specflow 3.1.21-beta and it's all working fine.
Thanks @SabotageAndi

FYI it's also possible to experience this issue with .NET Core 2. Whilst C# 8 features are only officially supported in .NET Core 3, it is still possible to use some of them in earlier versions (like 2.2.401 for example). Ask me how I know :-)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings