Skip to content

VSTHRD110 mis-fires on null coalescing operator #881

@AArnott

Description

@AArnott

Bug description

When an async method's result is returned with ?? operator, VSTHRD110 claims the result isn't returned or awaited.

Repro steps

        internal Task<T> GetClientAsync<T>(CancellationToken cancellationToken) where T : VssHttpClientBase
        {
            return _vssConnection?.GetClientAsync<T>(cancellationToken) ?? Task.FromResult<T>(null);
        }

Expected behavior

No warning.

Actual behavior

A warning.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions