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

Regression in 4.11.0-rc1: Unhelpful exception message with SetupProperty #823

Closed
stakx opened this issue May 7, 2019 · 0 comments · Fixed by #824
Closed

Regression in 4.11.0-rc1: Unhelpful exception message with SetupProperty #823

stakx opened this issue May 7, 2019 · 0 comments · Fixed by #824
Assignees
Labels
Milestone

Comments

@stakx
Copy link
Contributor

stakx commented May 7, 2019

Reproduction code:

public interface IFoo
{
	string this[int index] { get; set; }
}

var mock = new Mock<IFoo>();
mock.SetupProperty(m => m[1]);

Actual behavior:

In 4.11.0-rc1, the call to SetupProperty will raise an ArgumentException with the following nonsensical message:

Expression must be writeable
Parameter name: left

Expected behavior:

The exception should include a more helpful exception message, like in 4.10.1:

Expression is not a property access: m => m[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant