Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps recognized as undefined when using primary constructors (C# 12) in Step Definition classes #267

Open
DanielGilConpend opened this issue Feb 21, 2025 · 0 comments

Comments

@DanielGilConpend
Copy link

DanielGilConpend commented Feb 21, 2025

👓 What did you see?

In a .NET project, using primary constructors for a Step Definition class causes the Gherkin steps to be unrecognized by the Cucumber extension, showing them as undefined steps. This issue is confirmed by the fact that reverting the constructors back makes the Go to Step Definition feature work again.

  • The Go to Step Definition feature does not work when using primary constructors.
  • Gherkin steps are recognized as undefined steps when Step Definition classes use primary constructors.

✅ What did you expect to see?

  • Go to Step Definition feature should work even when using primary constructors.
  • Gherkin steps should be recognized as defined steps when Step Definitions classes use primary constructors.

📦 Which tool/library version are you using?

Visual Studio Code v1.97.2
Official Visual Studio Code Extension for Cucumber v1.10.0
C# 12
Reqnroll
Playwright .NET v1.50

🔬 How could we reproduce it?

Pre-conditions:

  • Use the tools described in the section above.

Steps to reproduce:

  1. Define a Gherkin scenario in a Feature file.
  2. Create a class for its Step Definitions.
  3. Implement primary constructors in this class.
  4. Build the solution.
  5. Verify the Go to Step Definition feature.

Image
Image

📚 Any additional context?

Primary constructors docuementation:
https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#primary-constructors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant