Skip to content
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

Query: Group by on Join without DefaultIfEmpty throws ArgumentException #5171

Closed
mikary opened this issue Apr 25, 2016 · 1 comment
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@mikary
Copy link
Contributor

mikary commented Apr 25, 2016

Similar to #3316, an ArgumentException is thrown when compiling the following query:

[ConditionalFact]
public virtual void GroupBy_join_anonymous()
{
    AssertQuery<Order, OrderDetail>((os, ods) =>
        (from order in os
            join orderDetail in ods on order.OrderID equals orderDetail.OrderID into orderJoin
            from orderDetail in orderJoin
            group new
            {
                orderDetail.ProductID,
                orderDetail.Quantity,
                orderDetail.UnitPrice
            } by new
            {
                order.OrderID,
                order.OrderDate
            })
            .Where(x => x.Key.OrderID == 10248),
        asserter: (l2oResults, efResults) =>
        {
            var l2oGroup = l2oResults.Cast<IGrouping<dynamic, dynamic>>().Single();
            var efGroup = efResults.Cast<IGrouping<dynamic, dynamic>>().Single();

            Assert.Equal(l2oGroup.Key, efGroup.Key);

            Assert.Equal(
                l2oGroup.OrderBy(element => element.ProductID),
                efGroup.OrderBy(element => element.ProductID));
        });
}

Exception details:

System.ArgumentException occurred
  HResult=-2147024809
  Message=Argument type 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Storage.ValueBuffer]' does not match the corresponding member type 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.Northwind.OrderDetail]'
  Source=System.Core
  StackTrace:
       at System.Linq.Expressions.Expression.ValidateNewArgs(ConstructorInfo constructor, ReadOnlyCollection`1& arguments, ReadOnlyCollection`1& members)
  InnerException: 
@maumar
Copy link
Contributor

maumar commented Apr 12, 2017

This issue is now fixed, regression test added here: f274b88

@maumar maumar closed this as completed Apr 12, 2017
@maumar maumar added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed type-investigation labels Apr 12, 2017
@divega divega added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. labels May 10, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants