-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Collection bug #2450
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
Collection bug #2450
Conversation
| Assign(passedDestination, destExpression), | ||
| assignNewExpression, | ||
| Call(destination, clearMethod), | ||
| ToType(mapExpr, createInstance.Type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid question. Wouldn't this be sufficient not to cast the result back? Not sure why anything else would be needed. The problem wasn't that collection was a List when passed down it's cause it was casted as such instead of ICollection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's where I started with, just removing this piece. The problem is our execution plan includes two paths for deciding what concrete type to create.
| return Constant(null, typeof(string)); | ||
| } | ||
|
|
||
| if (type.IsInterface()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? CollectionMapper returns ICollection it's just casts to List instead of left as instance type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is called in a few places so I can't assume what the mappers do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's not that bad :) What about ISet? Maybe move arrays here too? Or move this code there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll get another PR for that for now lgtm
|
Here's the before/after execution plan: |
|
Ok looks good enough to me. Also I don't feel like debugging Expressions atm. :) |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This fixes the newly introduced issue of casting collection types. I didn't think forcing everyone to use
UseDestinationValuewas a good solution, this change centers around the interfaces and the concrete types are only used for instantiation.