-
Notifications
You must be signed in to change notification settings - Fork 754
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
Type or namespace [TestNamespace]_XunitAssemblyFixture could not be found #1825
Comments
Which exact version of SpecFlow are you using? |
And what is the root namespace of this project? |
I use Specflow version 3.1.67. |
I have the same issue. The name of the test project is: Mooc |
Same issue here, same parameters as the OP, except we're on .NET Core 3.1 |
Same Issue, with similar naming |
Updating to
did not solve it either. Downgraded both to 3.0.225 to fix it. |
Interesting is also that the "Output" window says
(regardless of the version, same for 3.1.67) and if you filter for "Build Only" in the "Error List" window, it says 0 errors. So it might really be related to IntelliSense in some way...?! |
We have the same issue, the tests do run successfully however. On .net core 3.1 |
I am able to confirm that the test do run successfully, and that this is an IntelliSense only issue for me. |
Ah, now I know what is happening here. You all have probably R# installed. When you opened the |
I didn't install R# on my computer. Never. Hopefully, in my case tests now do run successfully too. |
I don't have R# installed. |
Also no R# here. Or to be more precise: It is suspended. |
Hey guys, I had a discussion with @SabotageAndi. BTW there is an ongoing PR which will move the generated files to the |
@timmkrause @xavalon263 @Leanwit @jjdd12 @faso |
The solution does build, but I still get the errors in Rider. I can work with it for now. But it is not sustainable. It's harder to see the actual errors and warnings. How soon do you think the PR will complete? |
@mootalk So you get this errors in Rider without even opening the |
Yes, it does compile however and the tests succeed. But if I look at the list of errors and warnings in the solution they do show up |
Same here with rider |
Same here. IDE: Rider 201903 |
Same here with VS 16.4.4 |
@epresi had a look at this and we discussed the options. We think when we merge PR #1691, which moves all of the It can take some time to get #1691 into master. There are still some merging conflict and problems with the PR. |
solved by disabling full solution analysis https://docs.microsoft.com/en-us/visualstudio/code-quality/how-to-enable-and-disable-full-solution-analysis-for-managed-code?view=vs-2019 |
Using
and VS 2019 16.4.4 without R#. Cleaned everything ( But to be honest, disabling full solution analysis is just a temporary workaround for me. Still stuck on 3.0.225. Additionally this blocks our .NET Core 3.1 migration because of |
What is the status on this? |
I got rid of the errors by adding the following to the specflow test csproj: <ItemGroup>
<Compile Remove="*.feature.cs" />
</ItemGroup>
<ItemGroup>
<None Include="*.feature.cs" />
</ItemGroup> |
@arkiaconsulting with that you remove the code-behind files from your assembly and so you have no scenarios anymore to execute. |
@SabotageAndi after having cleaned, deleted *.feature.cs files, unloaded then reloaded the project, rebuilt, I still have all my scenarii and all my tests pass... |
Hi guys, it's been a while since this bug was raised and there is still no any fox for this, is there? |
@czarls SpecFlow is an Open Source Project that depends on the contributions of its community. We are only a small team and can't do everything. I am happy to help to get people started working on SpecFlow anytime and review pull requests. |
@SabotageAndi
|
@SabotageAndi This solves the problem for Resharper but the Visual Studio still highlights this as an error... |
@godrose Does it only display it as error, or are you getting a real compile time error? Is it listed in the output window? What happens if you build on command line? |
@SabotageAndi output window only. The build is fine. |
Are they opening the |
I have this exact same problem, the project compiles fine, but the IDE is complaining that A workaround may be to have SpecFlow generate that class as a |
Yes they do )) |
@MatthewLymer What do you mean exactly? |
Why? There is no need for that. All changes will be overwritten with the next build. |
Of course they don’t need to.
I’ll tell you what happens and why this is confusing.
Let’s say a developer builds the solution and something fails.
They immediately look at the output window and see there compilation errors
and the aforementioned error.
So when they will have fixed the real compilation errors there will still
be this false error. And this is confusing them.
On Wed, 17 Feb 2021 at 15:56 Andreas Willich ***@***.***> wrote:
Are they opening the feature.cs files? I never saw this, when I didn't
opened them.
Yes they do ))
Why? There is no need for that. All changes will be overwritten with the
next build.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1825 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3OII6QWXAWINMJ3X4HSMLS7PDJPANCNFSM4J4HVH7Q>
.
--
Best Regards,
Gennady Verdel
|
Understood, and then they are in a loop. |
If I have the following code in my integration test assembly:
Then this satisfies the design-time errors, however, when I finally build the solution I get:
Which if the generated class had @SabotageAndi |
@SabotageAndi
Right. I already remove the generated code out of the source control. It’s
never committed and no conflict is introduced there.
On Wed, 17 Feb 2021 at 16:22 Matthew Lymer ***@***.***> wrote:
@MatthewLymer <https://github.com/MatthewLymer> What do you mean exactly?
If I have the following code in my integration test assembly:
public partial class MyApp_XUnitAssemblyFixture
{
}
Then this satisfies the design-time errors, however, when I finally build
the solution I get:
xUnit.AssemblyHooks.cs(8, 14): [CS0260] Missing partial modifier on declaration of type 'MyApp_XUnitAssemblyFixture'; another partial declaration of this type exists
Which if the generated class had partial on it, I would get no
design-time errors OR any compile time errors, thus working around the
problem.
@SabotageAndi <https://github.com/SabotageAndi>
For a lot of IDEs like JetBrains Rider or Visual Studio when using
Resharper, you don't even need to open the file before you'll be notified
errors in the solution
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1825 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3OII47QKXHF3H3QG646SDS7PGKHANCNFSM4J4HVH7Q>
.
--
Best Regards,
Gennady Verdel
|
If anyone's looking for a good workaround, I think I have one. It works on my company's project that leverages there's 2 parts, the first part is to create a partial class for the class that the IDE is saying is not found:
It's important that it is NOT in a namespace. Also, obviously update the class name to match your project name's hierarchy, so for my company it ended up being The second part is to update your csproj to include a target that will add the
I put this immediately after the Voila, no IDE errors, and no compile errors, SpecFlow bliss. Credits for https://stackoverflow.com/a/22571621/507793 for the code snippet to update a text file during FYI I'm running this on Windows 10 with .NET Core SDK 3.1.404 |
@MatthewLymer we could make the class partial by default. So if somebody is submitting a PR for it, you would not need the whole second step. |
Changing the main code base to allow a workaround. Doesn‘t feel right to me. How about fixing the root cause and eliminating a workaround to get the out of the box experience right for new users? |
@timmkrause The problem is, that it is a lot of work to get the out-of-the-box experience right. If it would be, I would have already fixed it. The problem here is, that Visual Studio and Resharper aren't looking at all files they should. The compiler is doing it. So we need to work around a wrong behavior of IDEs. And the only workaround we know is a lot of work where we need to be sure that a lot of other stuff (e.g. navigation) is still working. And please don't forget. SpecFlow is an open-source project. It depends on the contributions of its users. We are only a small team with limited time. So if you want to see this bug go away, jump at #1983 and finish it. And don't wait for Tragedian to do the work for you. |
I started making an MR to add the My current thinking is 2 parts:
|
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. |
SpecFlow Version:
Used Test Runner
Version number:
Project Format of the SpecFlow project
packages.config
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation
NuGet packageSpecFlowSingleFileGenerator
custom toolVisual Studio Version
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settingsAre the latest Visual Studio updates installed?
<Major>.<Minor>.<Patch>
.NET Framework:
Test Execution Method:
Issue Description
When the feature.cs file is generated the constructor gets an argument with a generated type [TestNamespace]_XUnitAssemblyFixture which cannot be found and lead to a compile error.
public MyFeature(MyFeature.FixtureData fixtureData, Test_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper)
The text was updated successfully, but these errors were encountered: