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

Utility Analyzer: Decouple file I/O from Roslyn threads #8460

Open
martin-strecker-sonarsource opened this issue Dec 11, 2023 · 0 comments · May be fixed by #8459
Open

Utility Analyzer: Decouple file I/O from Roslyn threads #8460

martin-strecker-sonarsource opened this issue Dec 11, 2023 · 0 comments · May be fixed by #8459
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: Performance It takes too long.

Comments

@martin-strecker-sonarsource
Copy link
Contributor

The Roslyn tasks that execute our analyzers expect that the logic is purely CPU-bound. It is highly discouraged to do any I/O in analyzers and source generators (citation needed).
The utility analyzer write to disk in the compilation end step and therefore performing I/O and block the analyzer thread. We should

  • Perform the file I/O on a dedicated thread (not under Roslyns control)
  • Start the file I/O as soon as the data is available and not only in the end step
  • Do as little blocking as necessary in the end step to wait for the I/O thread to finish it's remaining work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: Performance It takes too long.
Projects
None yet
2 participants