-
Notifications
You must be signed in to change notification settings - Fork 457
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
RS1022 slowing down build of non-analyzer project #6676
Comments
This was also filed as AB#1837711. The root cause of the performance overhead of RS1022 is it incorrectly defaults to permissive mode (it allows a The fix for this issue is to modify the default behavior of this analyzer to be strict:
|
In the binlog provided on the feedback ticket, I determined that the analyzer is introduced indirectly by the Microsoft.VisualStudio.Web.CodeGeneration.Design NuGet package. Prior to the implementation of strict mode described above, the performance overhead of this analyzer can be avoided by disabling RS1022 in the .editorconfig file for the project. |
I set |
You may need to set it in .globalconfig instead of .editorconfig. |
I've created a
but it doesn't seem to be working. As far as I can tell from the documentation it should be working:
|
Can you please share your .editorconfig file? I am curious how deleting it causing the build to be faster |
Sorry, my comment about deleting In this solution the problem is The list of disabled analyzers is at the end of the file. |
Is not being able to turn RS1022 off using |
Yes, definitely. Can you please file a separate issue for it? Thanks for bringing it to our notice. |
What's the ETA on vNext, since I don't have a workaround for this? |
@ghosttie - meanwhile, you can reference the latest prerelease version from this public feed: https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet8/NuGet/Microsoft.CodeAnalysis.Analyzers |
This is still happening in .NET 8 |
Hi @ghosttie, I believe RS1022 is disabled by default in .NET 8. If you are experiencing issues with this analyzer, it sounds like a project is either referencing an old version of the analyzer package, or the project configuration has been updated to explicitly enabled RS1022. Can you collect a .binlog for your build by passing |
I don't see any analyzers included in any of the project files and my If I'm reading this correctly, Microsoft.VisualStudio.Web.CodeGeneration.Design has transitive dependencies on Microsoft.CodeAnalysis.CSharp v4.8 and Microsoft.CodeAnalysis.Razor v6 - could those be the problem? Also adding
to |
Hi @ghosttie, We would need to see a .binlog or a reproducing solution in order to investigate further. These can be submitted through the feedback system to avoid posting the information publicly. Thanks! |
OK I attached the binlog to this feedback |
Hi @ghosttie, Thank you for providing that information. It appears that the following sequence of dependencies leads to this problem:
You'll need to force Microsoft.CodeAnalysis.Analyzers to use a newer version in one of the following two ways:
|
On NuGet it looks like 3.3.4 is the latest version of Microsoft.CodeAnalysis.Analyzers |
So there is no newer version of the package to upgrade to - can you verify that it's fixed in Microsoft.CodeAnalysis.Analyzers 3.3.4? |
@ghosttie This was answered above: The latest versions are now going to this feed: The feed changes when we start working on a new version of .NET. |
Sorry, I didn't realize the CodeAnalysis had a separate release cycle from .NET, I assumed it would have been released with .NET 8 I can confirm that it is fixed in 3.11 |
Analyzer
Diagnostic ID: RS1022:
Do not use types from Workspaces assembly in an analyzer
Analyzer source
SDK: Built-in CA analyzers in .NET 7 SDK or later
Version: SDK 7.0.400-preview.23225.8
Describe the bug
I was trying to debug why builds of my application take a really long time.
If I delete my
.editorconfig
file, the build is fast, so I figured the problem was an analyzer.I followed the instructions here to run msbuild with logging enabled, to see which analyzers were taking all of the time. Almost all of the build time is taken up by one analyzer:
Microsoft.CodeAnalysis.CSharp.Analyzers.MetaAnalyzers.CSharpDiagnosticAnalyzerApiUsageAnalyzer (RS1022) = 2:15.691
RS1022 appears to be intended to analyze analyzer projects, but my application isn't an analyzer, it's an ASP.NET Core MVC app, so I don't know why it's even running.
I don't have any analyzer nuget packages installed and setting
dotnet_diagnostic.RS1022.severity = none
in.editorconfig
didn't turn it off.Steps To Reproduce
I can reproduce this every time I build my application, but I don't know what's causing it so I can't tell you how to reproduce it.
The text was updated successfully, but these errors were encountered: