Closed pinkfloydx33 closed 3 years ago
In 0.22.8 we added support for c# source analyzers. It looks like this causes problems when you don't use source analyzers. From the logs it looks like Stryker handles this gracefully is that correct?
So far as I can tell that is correct. It just blurts out the warnings to the console but otherwise seems to run the same as before.
Yeah I can confirm this noise has appeared. Nothing bad happens really but those messages probably shouldn't be there or at least should be "quieter". @JohnMcGlynnMSFT FYI.
For clarifications, this messages are here on purpose: I asked for them. They come from the support of Roslyn source code generator and they signal Stryker failed to load an assembly that may contain a generator; a situation that would likely lead to failed build. In this case, this is clearly an analyzer that failed to load (based on the assembly name), so it may be seen as noise. Sadly, the situation is quite complex:
In short, we clearly need more testing and feedback from users to decide how to proceed with this. If those messages were quieter, it may lead to unexplained failure from Stryker.
Thank you for the clarification @dupdob. I agree that we should keep this logging. Perhaps we could downgrade the exception to debug logging but keep the warning message above it as warning so we don't alarm users as much as we currently do. And also explain in the logging that if the warning is about an expected Analyzer that it can be ignored and if it's referencing a source generator that it could be a problem?
That all makes sense to me.
Would it make sense (or even be possible) to automatically exclude the framework analyzers by name, ie. the ones that come just from using net5.0/net6.0 and aspnetcore? Those are never going to be "user" code so loading them seems unnecessary. That would prevent the warning and exception logged for those cases but keep them for others, without changing the log level.
Obviously that wouldn't cover analyzers from other referenced projects, which I think is OK. These specific ones are going to start appearing in projects by default meaning pretty much every run of Stryker for net5+ will spam the output.
I do wonder what these built in analyzers.. Do exactly. Perhaps they do stuff with editorconfig and such and then it still can explain certain behaviors when they don't work.
The add a lot of built in code fixes, new configurable diagnostics, usage/best practices tweaks and the like. A lot of stuff requested by the community that doesn't need to be a part of the actual language spec. They're adding more and more of them with each release.
Priority is to have analyzers working 😉. Every analyzer I tested exhibits this very problem: being unable to resolve basic analyzer dependencies, so fixing it once should fix it everywhere.
As a workaround, we can treat specifically assemblies that fail to load due to Microsoft.CodeAnalysis.Workspaces
Related to this issue: https://github.com/JosefPihrt/Roslynator/issues/833#issuecomment-894577987
Give this a whirl: https://github.com/stryker-mutator/stryker-net/pull/1702
Describe the bug When running Stryker against a .NET 5.0 project, errors/
FileNotFoundException
s are logged to the console as warnings. These appear to be related to built-in analyzers automatically added when targeting .NET 5.0.This behavior is exhibited in 0.22.9 but not in 0.22.6
Logs
Expected behavior No exceptions are logged
Desktop (please complete the following information):
Additional context I see the errors whether my project targets only .NET 5.0 or if it's multi-targeted.