Query: Select with new DTO taking entity in constructor argument throws ArgumentException #8282
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
I get this error when I Execute the following Linq Statement:
This is the whole exception message:
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
inner exception:
ArgumentException: The given expression 'new Account([x])' does not contain the searched expression '[x]' in a nested NewExpression with member assignments or a MemberBindingExpression.
As other already pointed out here #4807 the issue does not occur if you add AsNoTracking() to the query.
Also I found out, that the issue only occurs when the Select statement is added. When you have it as follows it works:
Account Entity looks as follows:
The text was updated successfully, but these errors were encountered: