Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSTHRD110 fires in Expression-valued scenarios #1167

Open
iouri-s opened this issue Mar 18, 2023 · 1 comment
Open

VSTHRD110 fires in Expression-valued scenarios #1167

iouri-s opened this issue Mar 18, 2023 · 1 comment

Comments

@iouri-s
Copy link
Member

iouri-s commented Mar 18, 2023

Bug description

When a Task-valued lambda is passed into a method expecting an Expression<> argument, VSTRD110 shouldn't fire, because no invocation is likely being made.

Repro steps

Code to reproduce the behavior.

Write a test using Moq library in VisualStudio:

using Moq;

var mock = new Mock<ILogger>();
mock.Verify(
    x => x.InfoAsync(It.IsAny<string>()),
    Times.Never,
    "No Log should have been written");

public interface ILogger
{
    Task InfoAsync(string message);
}

Expected behavior

No warning.

Actual behavior

VSTHRD110 warning.
image

  • Version used: 17.5.22
  • Application (if applicable):
    Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
    Version 17.4.5

Additional context

Add any other context about the problem here.

@AArnott
Copy link
Member

AArnott commented Mar 20, 2023

Thank you for this report. It makes sense and I agree with your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants