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

Moq1200 incorrectly firing on overridable member #143

Closed
rjmurillo opened this issue Jul 6, 2024 · 0 comments · Fixed by #221
Closed

Moq1200 incorrectly firing on overridable member #143

rjmurillo opened this issue Jul 6, 2024 · 0 comments · Fixed by #221
Assignees
Labels
analyzers Change that impacts an analyzer behavior bug .NET Pull requests that update .net code
Milestone

Comments

@rjmurillo
Copy link
Owner

Analyzer Moq1200 is incorrectly firing in the following case

public interface IFoo
{
  Task<bool> DoSomethingAsync();
}

var mock = new Mock<IFoo>();
mock.Setup(foo => foo.DoSomethingAsync().Result).Returns(true);

The analyzer indicates the Setup should be used only for overridable members; however, this member is on an interface while the error only makes sense if the method is on a class.

@rjmurillo rjmurillo added bug analyzers Change that impacts an analyzer behavior .NET Pull requests that update .net code triage labels Jul 6, 2024
@rjmurillo rjmurillo added this to the v0.2.0 milestone Jul 6, 2024
@rjmurillo rjmurillo self-assigned this Jul 6, 2024
@rjmurillo rjmurillo removed the triage label Jul 6, 2024
rjmurillo added a commit that referenced this issue Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzers Change that impacts an analyzer behavior bug .NET Pull requests that update .net code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant