question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RemoteAvgAgregator throws InvalidCastException

See original GitHub issue

Dear 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
coeamydcommented, Jan 10, 2019

The fix looks like it’s working. Thanks for the fast response!

Keep up the good work 😃

0reactions
coeamydcommented, Jan 16, 2019

Perfect, thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

InvalidCastException Class (System)
An InvalidCastException exception is thrown when the conversion of an instance of one type to another type is not supported. For example, attempting...
Read more >
ASP.Net C# How can i suppress Invalid Cast Exception for ...
I have a controller method that receives a JObject as a body parameter. When I enter an array (JArray) or a string (JValue)...
Read more >
Your XAML Solutions for most common issues (WIKI POST ...
Runtime Execution Error - Invalid Cast Exception ... Deployment of Uipath App in a remote machine / web application.
Read more >
Viewing online file analysis results for 'BCSIM.exe'
Persistence: Writes data to a remote process; Fingerprint: Reads the active computer name; Spreading: Opens the MountPointManager (often used to detect ...
Read more >
Beginning C# 5.0 Databases
Try It: Causing an Exception to Occur and Observing the Behavior. 189. Exploring the Type, Message, and StackTrace Properties ofan Exception.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found