vs-threading
vs-threading copied to clipboard
VSTHRD103 mis-fires when async version is not accessible (ie., not public)
Bug description
When calling an available (eg. public) sync method, and the target object has a method which is not available (eg. protected) and is "async" (returns task-like, has same signature, and ends with "Async"), it suggests to use it.
Repro steps
class Foo
{
string? _text;
public void Bind(string text) => this._text = text;
protected async Task BindAsync(string text) { this.Bind(text); await this.HandleBoundAsync(); }
protected async Task HandleBoundAsync() { ... }
}
var foo = new Foo();
foo.Bind("abc"); // VSTHRD103
Expected behavior
Should not fire
Actual behavior
Fired
- Version used: 17.2.32
- Application (if applicable):