Unplanned
Last Updated: 07 May 2021 18:53 by Douglas
Plamen Ratchev
Created on: 10 Feb 2021 12:43
Type: Bug Report
4
Invalid value for parameter 'ParameterName' when the parameter is float and the value is 0 or negative whole number in .NET Core projects
Float report parameter = 0 or negative whole number is returned as int and an exception is thrown in the viewer. The issue is observed only in .NET Core projects.
2 comments
Douglas
Posted on: 07 May 2021 18:53

Hi Adam,

I reported issue as work around I added a const called HACK when I set parameter..

const float HACK = 0.000001f;
reportSource.ParameterValues["Test"] = (float)10.0+HACK;

Its only work around I found.

 

Regards

Doug

 

Adam
Posted on: 07 May 2021 18:50

I have the same issue except any whole number causes results in an invalid value.

I'm Using the reporting API and confirmed that even when a parameter value is a floating point type (Either System.Single or System.Double) that the exception is thrown. Unless the value has any decimal precision to it.

For example, create an empty report, then add 1 floating point parameter "Test" with a default value of 1.

In the API controller, I override one of the default actions to override the parameter value:

// Results in an invalid value exception
public override IActionResult CreateInstance(string clientID, [FromBody] ClientReportSource reportSource) {
reportSource.ParameterValues["Test"] = (float)10.0;
}

// Does not throw an exception and everything works
public override IActionResult CreateInstance(string clientID, [FromBody] ClientReportSource reportSource) {
reportSource.ParameterValues["Test"] = (float)10.1;
}