Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

VSTHRD110 false positive fires when parentheses are added #1168

Copy link
Copy link

Description

@iouri-s
Issue body actions

Bug description

Repro steps

Code to reproduce the behavior.

class Class1
{

    public Func<Task<Dictionary<string, int>>>? VCLoadMethod;


    public Dictionary<string, int>? VirtualCurrencyBalances
    {
        get
        {   // This has no issue:
            // return VCLoadMethod?.Invoke().GetAwaiter().GetResult();

            // This triggers the warning:
            return (VCLoadMethod?.Invoke()).GetAwaiter().GetResult();
        }
    }
}

While parentheses are pointless in this case, they may be needed in more complex constructs such as (VCLoadMethod?.Invoke() ?? Task.FromResult(default(Dictionary<string, int>))).GetAwaiter().GetResult();
image

Expected behavior

Expect no warning.

Actual behavior

VSTHRD110

  • Version used:
  • Application (if applicable):

Additional context

Add any other context about the problem here.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.