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

Unable to compile test project when classlib with TestCaseSources is referenced #304

Closed
adamvlasak opened this issue Oct 27, 2020 · 6 comments · Fixed by #305
Closed

Unable to compile test project when classlib with TestCaseSources is referenced #304

adamvlasak opened this issue Oct 27, 2020 · 6 comments · Fixed by #305
Labels
Milestone

Comments

@adamvlasak
Copy link

Hi,

I am trying to use NUnit.Analyzers and also TestCaseSource attribute documented on

I have prepared public gist showing the behavior I get while using classlib in test project solution. Maybe I am doing something wrong but I rather tell you about it as it might be scenario not used often.

Steps to reproduce:

Error I get (even though without NUnit.Analyzers tests run with no problem)

Can you please confirm it is a bug or tell me what I am doing wrong? Thank you very much.

@Dreamescaper
Copy link
Member

Certainly looks like a bug.
Will take a look.

@Dreamescaper
Copy link
Member

@adamvlasak
I exactly followed your steps, but cannot reproduce this issue.

Build succeeded.
    0 Warning(s)
    0 Error(s)

Could you share your example project as .zip archive?

@adamvlasak
Copy link
Author

foobar.zip

PS C:\repos\foobar> dotnet --list-sdks
3.1.202 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
3.1.403 [C:\Program Files\dotnet\sdk]
PS C:\repos\foobar> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.403
 Commit:    9e895200cd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.403\

Host (useful for support):
  Version: 3.1.9
  Commit:  774fc3d6a9

.NET Core SDKs installed:
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.301 [C:\Program Files\dotnet\sdk]
  3.1.401 [C:\Program Files\dotnet\sdk]
  3.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@Dreamescaper
Copy link
Member

I see.
We haven't tested for case when data class is located in different assembly.
Interestingly enough this diagnostic does not appear in VS, only during build - probably it is able to resolve source information inside VS.

@adamvlasak
Copy link
Author

Yeah in VS2019 if you start building the solution you get NUnit1011 errors in both Error List and editor but when you click on one item in Error List it will disappear. That's why it was confusing for me.

@mikkelbu
Copy link
Member

mikkelbu commented Nov 2, 2020

This should be solved in the next release. A prerelease containing the fix can be found at https://www.myget.org/feed/nunit-analyzers/package/nuget/NUnit.Analyzers/0.6.0-dev-00594 (and newer versions).

@mikkelbu mikkelbu added the bug label Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants