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
Using the code shown below, we get the following error:
System.ArgumentException : Could not determine the correct positions for all argument matchers (1 in total) used in a call to this method: IHeaderDictionary.set_Location.
This could be caused by an unrecognized type conversion, coercion, narrowing, or widening, and is most likely a bug in Moq. Please report your use case to the Moq team.
We suspect the cause must be the coercion from string to StringValues via the implicit conversion operator. When using It.Is<StringValues>() the code works flawlessly.
Not crashing in this way. At a minimum, an error message indicating what was invalid about the matcher. Ideally, it would allow this coercion, since it heavily matches the code under test.
Exception with Stack Trace
System.ArgumentException : Could not determine the correct positions for all argument matchers (1 in total) used in a call to this method: IHeaderDictionary.set_Location.
This could be caused by an unrecognized type conversion, coercion, narrowing, or widening, and is most likely a bug in Moq. Please report your use case to the Moq team.
at Moq.ActionObserver.<ReconstructExpression>g__GetArgumentExpressions|0_0[T](Invocation invocation, Match[] matches) in /_/src/Moq/ActionObserver.cs:line 197
at Moq.ActionObserver.ReconstructExpression[T](Action`1 action, Object[] ctorArgs) in /_/src/Moq/ActionObserver.cs:line 53
at Moq.Mock`1.SetupSet(Action`1 setterExpression) in /_/src/Moq/Mock`1.cs:line 711
Version Info
Tested on Moq 4.20.69 and 4.20.70
The test case above uses the following NuGet packages:
Microsoft.AspNetCore.App.Ref 8.0.3
Microsoft.Extensions.Features 8.0.3
Additional Info
The text was updated successfully, but these errors were encountered:
Describe the Bug
Using the code shown below, we get the following error:
We suspect the cause must be the coercion from
string
toStringValues
via the implicit conversion operator. When using It.Is<StringValues>() the code works flawlessly.Steps to Reproduce
The following code reproduces this behavior:
Expected Behavior
Not crashing in this way. At a minimum, an error message indicating what was invalid about the matcher. Ideally, it would allow this coercion, since it heavily matches the code under test.
Exception with Stack Trace
Version Info
Tested on Moq 4.20.69 and 4.20.70
The test case above uses the following NuGet packages:
Additional Info
The text was updated successfully, but these errors were encountered: