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

Problems with loading Analyzer/Generator assemblies in .NET 7 #2317

Closed
psfinaki opened this issue Nov 14, 2022 · 7 comments
Closed

Problems with loading Analyzer/Generator assemblies in .NET 7 #2317

psfinaki opened this issue Nov 14, 2022 · 7 comments
Labels
🐛 Bug Something isn't working

Comments

@psfinaki
Copy link
Contributor

Describe the bug
Stryker emits some warnings on the topic when running under .NET 7. They don't seem to be very helpful though, as otherwise the mutation testing works seemingly fine.
image

Logs
I will attach the repro but since this might be some kind of an environmental issue, here is also the log:
log-20221114.txt

Expected behavior
Normal execution.

Desktop (please complete the following information):

  • OS: Windows
  • Type of project: .NET Core
  • Framework Version: .NET 7
  • Stryker Version: 3.1.0

Additional context
This is not the case for .NET 6.
Repro: Repro.zip

@psfinaki psfinaki added the 🐛 Bug Something isn't working label Nov 14, 2022
@pinkfloydx33
Copy link

I have had the same issue. You don't even necessarily need to be referencing .NET7, just the 7.0.0 versions of those packages which supposedly support .NET6. It tries to load/find all of the analyzers that are included by default in the SDK, even if you aren't using them. (I'm not sure, but it may also happen when referencing the 6.0.x versions but building with the 7.0 SDK)

They seem to be looking for ref assemblies, but I recall recently reading something about ref assemblies not being produced anymore (or at least, in the way they used to be) for inbox packages. Could this be related? Found it: here though perhaps I misunderstand the conversation.

@tdashworth
Copy link

Same problem here with a .NET 7 Blazor WASM application.

Repo: https://github.com/tdashworth/name-badge-automater

@tdashworth
Copy link

I have tried rolling back to .NET6 (with version 6 of Nuget packages) but still getting this:

[08:57:49 WRN] Stryker.NET encountered an compile error in ...NameBadgeAutomator\src\NameBadgeAutomater\Program.cs (at 7:27) with message: The type or namespace name 
'App' could not be found (are you missing a using directive or an assembly reference?) (Source code: App)
[08:57:49 WRN] Safe Mode! Stryker will try to continue by rolling back all mutations in method. This should not happen, please report this as an issue on github with the previous error message.

@centreboard
Copy link

Updating to .NET 7 I'm getting errors like:

[09:03:53 WRN] Analyzer/Generator assembly C:\hostedtoolcache\windows\dotnet\packs\Microsoft.AspNetCore.App.Ref\7.0.0\analyzers/dotnet/roslyn4.4/cs/Microsoft.Extensions.Logging.Generators.dll could not be loaded.
Generated source code may be missing.

which then fails to compile due to the generator not running.
Might #2318 help?

@rouke-broersma
Copy link
Member

@centreboard I suspect so

@psfinaki
Copy link
Contributor Author

Yeeeep it seems to help, at least it fixes the repro posted in this issue, I tried running Stryker from this branch.

@rouke-broersma
Copy link
Member

This is probably improved/fixed in 3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants