-
Notifications
You must be signed in to change notification settings - Fork 46
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
Reqnroll in RootNamespace breaks generated Files #44
Comments
Yes, this seems to be a problem. (SpecFlow has the "TechTalk." prefix in the namespace, and that's why it was better working there.) @priveLupus Could you please try to simulate the problem in a standard C# class library (without any feature file or Reqnroll package ref), that contains a file with an arbitrary class and a file that contains a class similar to the one Reqnroll generates? Maybe that would help to figure out what we need to change in the generator to fix this issue. Maybe we just need to include a couple of more |
I did. And it seems that adding the |
@priveLupus would be really appreciated. feel free to ask for help if you get stuck. The generator part of Reqnroll is pretty tricky sometimes. |
With the new Reqnroll.SystemTests the fix could be well guided. I think this will need a test in the GeneratorTestBase, so that it will be checked with all 3 test runners. This would be a good feedback for the new system test concept. @reqnroll/core-team anyone up for this? |
I will attempt it. Anything special or particular to be aware of with this issue? |
@clrudolphi As mentioned above, hopefully the fix will be to just add some "global" prefixes to the type declarations. I think the trickier will be to make the test. The test can be very similar to the one in the smoke test class, but we probably need to have a step with data table as well. I haven't checked, but surely there must be a way to configure the project name to be generated, so you can set it to something ends with ".Reqnroll". I can help if you get stuck. |
OK. I think we have two options and would like your direction. Option 2: The first works because the Reqnroll namespace is opened at the global level in the ImplicitUsings.cs file. In either case, the referencing syntax has to change to include the namespace alias qualifier :: Which would you prefer? |
@clrudolphi I would go for option 1. |
This fix changes all references to Reqnroll types in the generated code as global:: references.
* Fix for #44 Reqnroll in RootNamespace breaks generated Files This fix changes all references to Reqnroll types in the generated code as global:: references. * Moved test to GenerationTestBase. Modified Xunit2TestGenerationProvider so that it's reference to Reqnroll.xUnit classes were prefixed with global:: Modified GeneratorTests unit test to include the global:: prefix when looking for the FeatureInfo constructor in generated source. * Adjusted handling of Xunit generator's handling of references to Reqnroll types in order to not break VB generation. * Revised comment in CodeDomHelper regarding support for global:: namespace resolution for VB.NET.
Fixed by #85, thx @clrudolphi! |
Reqnroll Version
1.0.1
Which test runner are you using?
xUnit
Test Runner Version Number
2.5.6
.NET Implementation
.NET 6.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
No response
Issue Description
We use several frameworks in our solution, so using the names as part of the project name, assembly name and root namespace seemed logical. Putting Reqnroll in the root namespace however creates the following errors:
Any other name works.
Steps to Reproduce
create new Reqnroll Project in Visual Studio and add
<RootNamespace>Whatever.Reqnroll</RootNamespace>
to the project file
Link to Repro Project
No response
The text was updated successfully, but these errors were encountered: