-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Thousands of analyzer warnings are thrown inside Visual Studio #68764
Comments
Tagging subscribers to this area: @dotnet/runtime-infrastructure Issue Details
Repro: Open i.e. the System.Text.Json solution file with VS. cc @ericstj in case you have any ideas.
|
You could use procmon to see where it's looking? |
I believe that assembly comes with Visual Studio. The analyzers were updated with 5707668 (cc @jkoritzinsky). Do we know what the minimum supported version of VS is when using the 4.3.0 analyzers? If it's 17.3 then we likely broke the analyzers for anyone who doesn't have access to the IntPreview builds of VS. |
cc @dotnet/roslyn-analysis regarding my above question. |
This typically means that your analyzers are referencing a newer version of the compiler than the one you are building with. Are you referencing the 4.3 compiler? |
We are building with version Line 52 in 9f2add0
|
Unfortunately would need a binlog of the failing build to diagnose further. |
No, I'm using 17.2 Preview 5. I wasn't sure if 4.3.0 analyzers require 17.3, that's what I was asking above:
|
Yep, 17.3 maps top the 4.3 version of the compiler. |
Thanks @jmarolf. Naively asking as I don't know anything about how roslyn analyzers are hosted inside VS but would it eventually be possible to avoid the strong dependency on a newer version of VS? We regularly update the analyzers to benefit from new features but we shouldn't move faster than what is publicly available (to not leave the community behind). |
It is possible through a completely different design for the analyzers. StyleCop Analyzers employs an extensive (and complicated) lightup layer that allows it to compile against Roslyn 1.1 while lighting up to support anything newer. During a design review a while back, the Roslyn team reviewed options and costs associated with various versioning strategies and decided to lock the analyzer build to the compiler version via the public API. This means it is possible to use an older analyzer with a newer SDK or IDE, but it is not going to be possible use a newer analyzer with an older SDK or IDE. |
Thanks for the detailed response Sam. @agocke @stephentoub @danmoseley IMO we should treat analyzer updates as breaking changes. To be more precise, updating an analyzer's major or minor version will result in a dependency on a newer version of VS. In our example, our analyzers are depending on VS 17.3 which hasn't been released yet publicly which results in some analyzers being broken an tons of warnings being thrown. |
To be clear, this is for a developer working in Visual Studio on a dotnet/runtime csproj and not using a recent enough VS build, yes? i.e. this has zero impact on command-line builds, on CI, or on anyone consuming the output of builds, correct? |
Yes, correct. |
What does that look like -- holding off ingesting roslyn-analyzers until the monthly update day? Do all updates increment a major/minor version, if not how will we identify those? Would this make it harder for us to test our analyzer as we're developing them? |
Note that dotnet/roslyn-analyzers and dotnet/roslyn don't have exactly the same versioning for analyzers. The analyzers hard-locked to the compiler are in dotnet/roslyn (the code style analyzers with diagnostics IDExxxx). Analyzers implemented in dotnet/roslyn-analyzers have "slack" in the versioning, where we use light-up for a short period of time while things are being implemented, and then bump the referenced version of the compiler once it's readily available. |
I don't understand what this is referring to. What "analyzer" are you talking about @ViktorHofer? The roslyn-analyzer analyzers depend on an older version. To my knowledge it's the CodeAnalysis assemblies that the source generators and analyzers depend on, not the analyzers themselves, that are at issue here, e.g. Line 48 in 9f2add0
not Line 47 in 9f2add0
|
@sharwell just spent some of his time explaining to me how analyzers that depend on a specific VS version can be identified. The "Microsoft.CodeAnalysis" assembly that ships as part of VS indicates the required version of VS. In our case we use the following the analyzers that depend on the 4.3.0.0 version of Microsoft.CodeAnalysis and by that on VS 17.3:
Presumably we want to be intentional when updating these packages to not accidentally break our contributors that don't have access or don't want to use the IntPreview builds of VS. I just today discussed this with @ericstj offline and he mentioned that we ideally would have CI protection to make sure that these kinds of errors are caught. Even though that sounds like the right long term strategy we could meanwhile establish a policy that these packages are part of the monthly roll-out as @danmoseley mentioned above. Would that make sense? |
Also want to give some more context onto why the CodeStyle analyzers (IDExxxx) move to build against a newer version of compiler and VS (basically Microsoft.CodeAnalysis version) faster than the SDK code quality analyzers (CAxxxx in MS.CA.NetAnalyzers). The CodeStyle analyzers are largely tied to recommending new styles based on new language constructs coming out of the compiler. The analyzers themselves have a strong need to be able to access the compiler APIs and object models for newer language constructs. The CAxxxx code quality analyzers are primarily recommending correct usage of .NET APIs and generic code quality improvements, and very seldomly need to move to build against the latest compiler version, so we do it at a slower cadence so it can avoid breaks like the one you are seeing here. Hope that helps! |
Fixes #68764 The in the above issue mentioned warnings are resolved by using VS 17.3 (currently Preview1).
Fixes #68764 The in the above issue mentioned warnings are resolved by using VS 17.3 (currently Preview1).
Visual Studio 17.2 Preview 5
6.0.100 SDK
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
How is that assembly supposed to be referenced? Are we missing a PackageReference?
Repro: Open i.e. the System.Text.Json solution file with VS.
cc @ericstj in case you have any ideas.
The text was updated successfully, but these errors were encountered: