-
Notifications
You must be signed in to change notification settings - Fork 349
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
Fix argument null exception during projection #3038
Fix argument null exception during projection #3038
Conversation
Thanks for the catch. This must be due to change from |
The issue was introduced by this PR: #2916 The root issue is that |
Thanks @gathogojr for adding the tests |
More details from the investigation: var serviceRoot = new Uri("http://localhost:5205");
var ctx = new Container(serviceRoot);
var query1 = from people in ctx.People
where people.Spouse == null
select new Person
{
Id = people.Id,
Spouse = people.Spouse
};
// OData URL: http://localhost:5205/People?$filter=Spouse eq null&$expand=Spouse&$select=Id
var results1 = query1.ToList(); // Throws exception
var query2 = ctx.CreateQuery<Person>("People").Where(p1 => p1.Spouse == null).Select(p2 => new { p2.Id, p2.Spouse });
// OData URL: http://localhost:5205/People?$filter=Spouse eq null&$expand=Spouse&$select=Id
var results2 = query2.ToList(); // Throws exception
var query3 = ctx.People.AddQueryOption("$filter", "Spouse eq null").AddQueryOption("$expand", "Spouse").AddQueryOption("$select", "Id");
// OData URL: http://localhost:5205/People?$expand=Spouse&$filter=Spouse eq null&$select=Id
var results3 = query3.ToList(); // No exception thrown
var query4 = ctx.Execute<Person>(new Uri("http://localhost:5205/People?$expand=Spouse&$filter=Spouse eq null&$select=Id"));
// OData URL: http://localhost:5205/People?$expand=Spouse&$filter=Spouse eq null&$select=Id
var results4 = query4.ToList(); // No exception thrown
var query5 = ctx.Execute<Person>(new Uri("http://localhost:5205/People?$filter=Spouse eq null&$expand=Spouse&$select=Id"));
// OData URL: http://localhost:5205/People?$filter=Spouse eq null&$expand=Spouse&$select=Id
var results5 = query5.ToList(); // No exception thrown! Yet the OData URL mirrors that of the first two query expressions. Projection seems to be where the issue is |
Issues
This pull request fixes #3037.
Description
Fixes issue in ProjectionValueForPath() when linkEntry.Properties is null bypassing call to OfType().
Checklist (Uncheck if it is not completed)
Additional work necessary
Regression introduced in ODL Client 8.0.0-rc.1