You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.ArgumentException: Expression must be writeable
Parameter name: left
at System.Linq.Expressions.Expression.RequiresCanWrite(Expression expression, String paramName)
at System.Linq.Expressions.Expression.Assign(Expression left, Expression right)
at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method, LambdaExpression conversion)
at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right)
at Moq.ExpressionExtensions.<Split>g__Split|5_0(Expression e, Expression& r, InvocationShape& p) in …\src\Moq\ExpressionExtensions.cs:line 195
at Moq.ExpressionExtensions.Split(LambdaExpression expression) in …\src\Moq\ExpressionExtensions.cs:line 148
at Moq.Mock.SetupRecursive[TSetup](Mock mock, LambdaExpression expression, Func`4 setupLast) in …\src\Moq\Mock.cs:line 593
at Moq.Mock.Setup(Mock mock, LambdaExpression expression, Condition condition) in …\src\Moq\Mock.cs:line 529
at Moq.Mock.SetupSet(Mock mock, LambdaExpression expression, Condition condition) in …\src\Moq\Mock.cs:line 555
at Moq.Mock`1.SetupProperty[TProperty](Expression`1 property, TProperty initialValue) in …\src\Moq\Mock.Generic.cs:line 660
at Moq.Mock`1.SetupProperty[TProperty](Expression`1 property) in …\src\Moq\Mock.Generic.cs:line 616
Expected behavior:
The call to SetupProperty should succeed because Derived.P is both readable and writable.
Moq version used:
4.14.1
The text was updated successfully, but these errors were encountered:
Bumps [Moq](https://github.com/moq/moq4) from 4.14.7 to 4.15.2.
#Changelog
*Sourced from [Moq's changelog](https://github.com/moq/moq4/blob/master/CHANGELOG.md).*
> ## 4.15.2 (2020-11-26)
>
> #### Changed
>
> * Upgraded `System.Threading.Tasks.Extensions` dependency to version 4.5.4 (@JeffAshton, [#1108](devlooped/moq#1108))
>
>
> ## 4.15.1 (2020-11-10)
>
> #### Added
>
> * New method overloads for `It.Is`, `It.IsIn`, and `It.IsNotIn` that compare values using a custom `IEqualityComparer<T>` (@weitzhandler, [#1064](devlooped/moq#1064))
> * New properties `ReturnValue` and `Exception` on `IInvocation` to query recorded invocations return values or exceptions (@MaStr11, [#921](devlooped/moq#921), [#1077](devlooped/moq#1077))
> * Support for "nested" type matchers, i.e. type matchers that appear as part of a composite type (such as `It.IsAnyType[]` or `Func<It.IsAnyType, bool>`). Argument match expressions like `It.IsAny<Func<It.IsAnyType, bool>>()` should now work as expected, whereas they previously didn't. In this particular example, you should no longer need a workaround like `(Func<It.IsAnyType, bool>)It.IsAny<object>()` as originally suggested in [#918](devlooped/moq#918). (@stakx, [#1092](devlooped/moq#1092))
>
> #### Changed
>
> * Event accessor calls (`+=` and `-=`) now get consistently recorded in `Mock.Invocations`. This previously wasn't the case for backwards compatibility with `VerifyNoOtherCalls` (which got implemented before it was possible to check them using `Verify{Add,Remove}`). You now need to explicitly verify expected calls to event accessors prior to `VerifyNoOtherCalls`. Verification of `+=` and `-=` now works regardless of whether or not you set those up (which makes it consistent with how verification usually works). (@80O, @stakx, [#1058](devlooped/moq#1058), [#1084](devlooped/moq#1084))
> * Portable PDB (debugging symbols) are now embedded in the main library instead of being published as a separate NuGet symbols package (`.snupkg) (@kzu, [#1098](devlooped/moq#1098))
>
> #### Fixed
>
> * `SetupProperty` fails if property getter and setter are not both defined in mocked type (@stakx, [#1017](devlooped/moq#1017))
> * Expression tree argument not matched when it contains a captured variable – evaluate all captures to their current values when comparing two expression trees (@QTom01, [#1054](devlooped/moq#1054))
> * Failure when parameterized `Mock.Of<>` is used in query comprehension `from` clause (@stakx, [#982](devlooped/moq#982))
>
>
> ## 4.15.0
>
> This version was accidentally published as 4.15.1 due to an intermittent problem with NuGet publishing.
#Commits
- [`f2aa090`](devlooped/moq@f2aa090) ...
This is basically #886 again, which was fixed for
SetupAllProperties
but not forSetupProperty
.Reproduction code:
Actual behavior:
The call to
SetupProperty
throws this exception:Expected behavior:
The call to
SetupProperty
should succeed becauseDerived.P
is both readable and writable.Moq version used:
4.14.1
The text was updated successfully, but these errors were encountered: