RemoteAvgAgregator throws InvalidCastException
See original GitHub issueDear DevExtreme team,
we are using the DevExtreme.AspNet.Data library to deliver data to the dxDataGrid. We are now introducing group summaries and have hit an issue, that is most likely the same issue as with #182 (AVG summary caluclation is broken for Double data after #148). The fix for that issue fixed it only for local grouping and summaries, not for remote grouping.
The problem turns up in DevExtreme.AspNet.Data/RemoteGrouping/RemoteAvgAggregator.cs:line 28, where it tries to cast the result of the sum aggregator to a nullable decimal.
return (decimal?)_valueAggregator.Finish() / count;
Since the value returned by Finish
is boxed, a direct cast will lead to the InvalidCastException. We have been able to fix it by replacing that line with
var val = this._valueAggregator.Finish();
return val == null ? null : Convert.ToDecimal(val) / count;
We are, however, not sure if this is the optimal solution. Will you be able to supply an official fix for this?
Thanks for the good work on your products!
Cheers, Christoph
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
The fix looks like it’s working. Thanks for the fast response!
Keep up the good work 😃
Perfect, thanks a lot!