Skip to content

Scenario Outline codegen emits unqualified System.Linq → CS0234 when a namespace segment is named "System" #1112

Description

@mellis-ao

Reqnroll Version

3.3.4

Which test runner are you using?

TUnit

Test Runner Version Number

3.3.4

.NET Implementation

.NET 10.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

Do not have one

Issue Description

The code generated for a Scenario Outline references System.Linq.Enumerable
without a global:: qualifier, while the rest of the generated file is
global::-qualified. If any segment of the generated namespace is named System
(e.g. a feature under /System/...), the unqualified reference binds to the
project's own ...System namespace instead of the BCL System, and the build fails:

CS0234: The type or namespace name 'Linq' does not exist in the namespace
'MyProject.Tests.System' (are you missing an assembly reference?)

In <FeatureName>.feature.cs for a Scenario Outline:

@__tags = System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Concat(@__tags, exampleTags));

Everything else in the same file is already fully qualified, e.g.
global::System.CodeDom.Compiler.GeneratedCodeAttribute, so this is the sole
un-qualified System.* reference.

Please Note - Your template is outdated and has no options to select TUnit as the runner and .Net 10 as the implementation.

Steps to Reproduce

  1. Create a Reqnroll test project (RootNamespace e.g. MyProject).
  2. Add a feature file under a folder path containing a System segment, e.g.
    Tests/System/Features/Foo.feature, so the generated namespace is
    MyProject.Tests.System.Features.
  3. Give the feature a Scenario Outline with an Examples table.
  4. Build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions