Skip to content

Latest commit

 

History

History
47 lines (38 loc) · 3.1 KB

index.md

File metadata and controls

47 lines (38 loc) · 3.1 KB

Diagnostic Analyzers

The following are the diagnostic analyzers installed with the Microsoft.VisualStudio.Threading.Analyzers NuGet package.

ID Title Severity Supports Default diagnostic severity
VSTHRD001 Avoid legacy thread switching methods Critical 1st rule 🔡 Warning
VSTHRD002 Avoid problematic synchronous waits Critical 2nd rule Warning
VSTHRD003 Avoid awaiting foreign Tasks Critical 3rd rule Warning
VSTHRD004 Await SwitchToMainThreadAsync Critical 1st rule Error
VSTHRD010 Invoke single-threaded types on Main thread Critical 1st rule Warning
VSTHRD011 Use AsyncLazy<T> Critical 3rd rule Error
VSTHRD012 Provide JoinableTaskFactory where allowed Critical All rules Warning
VSTHRD100 Avoid async void methods Advisory Warning
VSTHRD101 Avoid unsupported async delegates Advisory VSTHRD100 Warning
VSTHRD102 Implement internal logic asynchronously Advisory 2nd rule Info
VSTHRD103 Call async methods when in an async method Advisory Warning
VSTHRD104 Offer async option Advisory Info
VSTHRD105 Avoid method overloads that assume TaskScheduler.Current Advisory Warning
VSTHRD106 Use InvokeAsync to raise async events Advisory Warning
VSTHRD107 Await Task within using expression Advisory Error
VSTHRD108 Assert thread affinity unconditionally Advisory 1st rule, VSTHRD010 Warning
VSTHRD109 Switch instead of assert in async methods Advisory 1st rule Error
VSTHRD110 Observe result of async calls Advisory Warning
VSTHRD111 Use .ConfigureAwait(bool) Advisory Hidden
VSTHRD200 Use Async naming convention Guideline VSTHRD103 Warning

Severity descriptions

Severity IDs Analyzer catches...
Critical 1-99 Code issues that often result in deadlocks
Advisory 100-199 Code that may perform differently than intended or lead to occasional deadlocks
Guideline 200-299 Code that deviates from best practices and may limit the benefits of other analyzers

Default diagnostic severity legend

Icon Meaning
🔡 The analyzer only produces diagnostics when configured.

Configuration

Some analyzers' behavior can be configured. See our configuration topic for more information.