We have many Telerik reports that are fed from SQL Server stored procedures, some of which pull from columns with a type of decimal(38,18) (SQL's max). The system that interacts with these reports uses C# and we limit the values for those columns to 28 significant figures (C#'s max).
For example, these values would not be supported by our system:
- 12,345,678,901.123456789012345678 (11 LHS digits + 18 decimals = 29 total digits)
- 12,345,678,901,234,567,890.123456789 (20 LHS digits + 9 decimals = 29 total digits)
While these would be:
- 12,345,678,901,234,567,890.12345678 (20 LHS digits + 8 decimals = 28 total digits)
- 1,234,567,890.123456789012345678 (10 LHS digits + 18 decimals = 28 total digits)
We're running into some "Conversion overflows" errors with numbers that have <= 28 significant digits, which after troubleshooting we found to be occurring in Telerik's internal SQL processing, specifically in the System.Data.SqlClient library. Which has this ticket logged: https://github.com/dotnet/SqlClient/issues/95
Our system uses Microsoft.Data.SqlClient, which correctly handles truncating trailing zeros.
Is there any option for Telerik using the Microsoft.Data.SqlClient library rather than the System.Data.SqlClient library or any other workaround available for this issue?
Here is the full stack trace:
System.OverflowException: Conversion overflows.
at System.Data.SqlClient.SqlBuffer.get_Decimal()
at System.Data.SqlClient.SqlBuffer.get_Value()
at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values)
at Telerik.Reporting.Processing.Data.SqlDataEnumerable.ReadValues(IDataReader reader)
at Telerik.Reporting.Processing.Data.SqlDataEnumerable.GetEnumerator()+MoveNext()
at Telerik.Reporting.Processing.Data.LazyList`1.LazyListEnumerator.MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at Telerik.Reporting.Processing.Data.SeedDataAdapter.Execute(IEnumerable`1 data)
at Telerik.Reporting.Processing.Data.ResultSetAdapter.Execute(IEnumerable`1 data)
at Telerik.Reporting.Processing.Data.MultidimentionalDataProvider.Execute(MultidimensionalQuery query)
at Telerik.Reporting.Processing.DataItemResolveDataAlgorithm.GetDataCore(IDataSource dataSource, MultidimensionalQuery query, IServiceProvider serviceProvider, EvalObject expressionContext, IProcessingContext processingContext)
at Telerik.Reporting.Processing.Report.GetDataCore(IDataSource dataSource, MultidimensionalQuery query)
at Telerik.Reporting.Processing.DataItemResolveDataAlgorithm.ResolveData(String processingId, InMemoryState inMemoryState, MultidimensionalQuery query, Func`1 getDataCore, EvalObject expressionContext)
at Telerik.Reporting.Processing.Report.ResolveData()
at Telerik.Reporting.Processing.Report.ProcessItemCore()
at Telerik.Reporting.Processing.Report.ProcessItem()
at Telerik.Reporting.Processing.ReportItemBase.ProcessElement()
at Telerik.Reporting.Processing.ProcessingElement.Process(IDataMember dataContext)