Repository navigation
Fix VSTHRD200 handling of custom awaitables - #1644
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Improves analyzer handling of custom awaitables by making awaitable detection inheritance-aware (fixing false positives for derived awaitables) and by adding an opt-in additional-file configuration to require the Async suffix for library-specific async-focused return types.
Changes:
- Extend
CommonInterest.AwaitableTypeTesterto recognize awaitable types via base classes and implemented interfaces (covers VSTHRD200 and VSTHRD110 usage). - Add
vs-threading.AsyncSuffixRequiredTypes.txtsupport to VSTHRD200 so libraries can opt-in custom return types that must use theAsyncsuffix. - Add regression tests and documentation for the new behavior and configuration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.VisualStudio.Threading.Analyzers.Tests/VSTHRD200UseAsyncNamingConventionAnalyzerTests.cs | Adds coverage for derived-awaitable returns and for the new async-suffix-required type configuration. |
| test/Microsoft.VisualStudio.Threading.Analyzers.Tests/VSTHRD110ObserveResultOfAsyncCallsAnalyzerTests.cs | Adds a regression test ensuring derived custom awaitables still produce diagnostics as expected. |
| test/Microsoft.VisualStudio.Threading.Analyzers.Tests/AdditionalFiles/vs-threading.AsyncSuffixRequiredTypes.mocks.txt | Provides a mocked additional-file entry to exercise the new VSTHRD200 configuration path in tests. |
| src/Microsoft.VisualStudio.Threading.Analyzers/VSTHRD200UseAsyncNamingConventionAnalyzer.cs | Reads configured async-suffix-required types and incorporates them into “async-focused return type” detection. |
| src/Microsoft.VisualStudio.Threading.Analyzers/CommonInterest.cs | Adds the new additional-file name pattern and updates awaitable detection to be inheritance-aware. |
| docfx/analyzers/VSTHRD200.md | Documents that custom async-focused return types can be configured to require the suffix. |
| docfx/analyzers/configuration.md | Adds documentation for vs-threading.AsyncSuffixRequiredTypes.txt format and usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Oleg Tkachenko (olegtk)
approved these changes
Aug 22, 2026
This was referenced Oct 26, 2026
Merged
Open
Closed
Bump the dev-minor-patch group with 16 updates
actions-marketplace-validations/macalbert_envilder#47
Open
Open
Open
Open
This was referenced Oct 27, 2026
Bump Microsoft.VisualStudio.Threading.Analyzers from 17.14.15 to 18.12.1
tomokuni/ZenHanConverter#19
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VSTHRD200 can incorrectly reject the
Asyncsuffix for derived awaitable types, while libraries have no way to identify custom types that should require the suffix.This change makes awaitable detection inheritance-aware and adds
vs-threading.AsyncSuffixRequiredTypes.txtconfiguration for opt-in async-focused return types. The shared awaitable detection improvement also covers VSTHRD110. Documentation and regression coverage are included.Fixes #419
Fixes #1023