I have a system that starts producing incorrect values after running for several hours. I reproduced it while under a debugger and found that the problem is System.Math.Round
begins returning incorrect values.
I have two instances of the same version of Visual Studio, running side by side on the same machine, with the same project, the same code, at the same part of the stack trace -- everything is identical -- except one has been running for hours and has begun failing, the other hasn't.
I execute a constant expression in their respective Immediate windows, and get different values.
In the good run:
In the bad run:
This small discrepancy has significant implications for my app.
.NET version, dumped from the running code:
System.Environment.Version
=> 4.0.30319.42000
(typeof(string).Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false))[0]
=> 4.8.4644.0
Has anyone seen this before? Is it a known bug? Is there a way I can workaround it?
EDIT: @Kit doesn't trust the Immediate Window so here's a bit more info. I showed the Immediate Window result because it lets you see that the same constant expression is producing different results from Math.Round
. Below is the line in the actual code where it's relevant, and you can see that Math.Round
is producing the wrong value in the actual code, too: