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

aggregation not supported for dynamic properties #760

kosinsky opened this Issue Feb 15, 2017 · 4 comments


None yet
3 participants

kosinsky commented Feb 15, 2017

Create OData endpoint for Items entity defined as

    public class Item
        public int ItemId { get; set; }
// other properties
        public IDictionary<string, object> DynamicProperties { get; set; }

Try to run query Items?$apply=aggregate(I with max as MaxId) where I is dynamic property.
It will fail with ArgumentNull exception:

at Microsoft.OData.ExceptionUtils.CheckArgumentNotNull[T](T value, String parameterName)
at Microsoft.OData.UriParser.Aggregation.AggregateExpression..ctor(SingleValueNode expression, AggregationMethod method, String alias, IEdmTypeReference typeReference)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindAggregateExpressionToken(AggregateExpressionToken token)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindAggregateToken(AggregateToken token)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindApply(IEnumerable`1 tokens)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApplyImplementation(String apply, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApply()
at System.Web.OData.Query.ApplyQueryOption.get_ApplyClause()

Assemblies affected

OData .Net lib 6.15.* OData .Net lib 7.0.*

Additional details

Reason is that for SingleValueOpenPropertyAccessNode TypeReference is null, but AggregateExpression expects not null

@kosinsky kosinsky changed the title from aggregation isn't supported for dynamic properties to aggregation not supported for dynamic properties Feb 15, 2017


This comment has been minimized.


robward-ms commented May 24, 2017

Merged, fixed.

@robward-ms robward-ms closed this May 24, 2017

@robward-ms robward-ms added the fixed label May 24, 2017


This comment has been minimized.


robward-ms commented May 24, 2017

Need port of #813 to 7.x


This comment has been minimized.


kosinsky commented May 24, 2017

Port to 7.x #816

xuzhg added a commit that referenced this issue Jun 8, 2017


This comment has been minimized.


xuzhg commented Jun 8, 2017

Fixed at: 88bd1a8

Thanks, and please let us know any problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment