Code Anslysis with disbaled live analysis does not show all warnings. #41365
Replies: 5 comments
-
This is by-design. By disabling "Run on live analysis" you explicitly requested not to compute and/or continuously analyze the source code to show current live analysis diagnostics. Explicit build is done against a specific snapshot, and you should switch the "Build + Intellisense" error list combo box to "Build only" to see warnings reported on last build.
I believe this should be fixed in latest 16.5 Preview drop, can you please try?
Are you suggesting that doing an explicit build in VS shows more warnings then doing so in console? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
There seems to be a slight misunderstanding on the feature, and I think I understand the cause for confusion. One might assume that live analysis is only additive, i.e. it can only add new diagnostics on top of the ones from last build. That is however not true. If build produced some diagnostics, and you changed the sources that fix some of these diagnostics, we would still need to re-trigger live analysis to identify the new set of applicable diagnostics for the current source snapshot, otherwise you can have stale diagnostics. However, retriggering analysis this will violate the user preference of not doing any live analysis and also consume resources. I think you have 2 alternatives when you disable live analysis:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the support! I had some misunderstanding regarding the usage of the "build" and "build + intelligent" selection. But I still don't think we are talking on the same thing. Because Solution 1 will not do anything for me. because the build / compiler does not report all the warnings that are in the code. I try to describe it from another angle:
The important thing for me is to have all the existing warnings in the code reported by the compiler to use created reports in my CI-build on Azure DevOps. |
Beta Was this translation helpful? Give feedback.
-
@LukasSchwendemann So, your primary issue is that after installing StyleCop analyzers and Sonar analyzers, you are seeing warnings from intellisense, but these are not showing up in command line build, correct? If so, that is not expected behavior. Can you provide a small standalone repro for us to investigate? |
Beta Was this translation helpful? Give feedback.
-
Version Used:
dotnet core 3.1
Visual Studio 2019 (16.4.3)
Microsoft.CodeAnalysis.FxCopAnalyzers 2.6.4
StyleCop.Analyzers 1.1.118
SonarAnalyzer.CSharp 8.3.0.14607
Steps to Reproduce:
Expected Behavior:
Actual Behavior:
Beta Was this translation helpful? Give feedback.
All reactions