Confusing error "needs to have a constructor with 0 args or only optional args" #3609
thomaslevesque
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
That seems difficult in the general case. But you're welcome to try a PR. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Source/destination types
Mapping configuration
Version: 10.1.1
Expected behavior
Should give an error saying that it can't resolve a value for constructor argument
z
, or something similar.Actual behavior
Gives the following error:
This is confusing, because FooDto doesn't actually need to have a constructor with 0 args or only optional args (it works fine with
record FooDto(string x, int y)
). The problem is really that it can't resolve the value forz
, so the error should say that.I started encountering the error quite frequently since I started using records. If there's a mismatch between properties of the source and destination types, I get this error. Now I know what to look for, but the first time I saw it I was really confused and it took me a while to understand what the problem was.
Steps to reproduce
Beta Was this translation helpful? Give feedback.
All reactions