Failing test - FromLowHighUnsigned_x32_Result #5716
Replies: 1 comment 14 replies
-
This is not correct, did you read the discussion we had in the linked PR? Changing both sign and size of an integer in one operation is ambigous (which operation happens first - sign change or widening? - it produces different results!) and has previously lead to bugs. Obviously the compiler picks one meaning, but even if it happens to match what you intend, being explicit is always better because the reader knows what is meant without looking it up. Casting first to uint, then widening to nuint, then changing sign again, is explicit in the order of operations and doesn't allow for mistakes. Now its possible that there is some bug hidden somewhere, normally C# doesn't throw overflow exceptions for arithmetic, but in your stacktrace I'm seeing it being thrown from
I'm not sure if its incorrect, I'd have to double check the C/C++ definition, but given what I said above about ambiguity my first guess would be that you seem to have broken the order of operations and now produce incorrect results with your proposed fix?
I haven't seen it failing, no. I'll double check though. |
Beta Was this translation helpful? Give feedback.
-
I would like to know if this test is failing for anyone else. This test fails for me on all build platforms.
System.Windows.Forms.Primitives.Tests.Interop.PARAMTests.FromLowHighUnsigned_x32_Result
PARAMTests.FromLowHighUnsigned_x32_Result
I believe the overflow is due to an issue in Interop.PARAM.FromLowHighUnsigned
Since we are now casting to nuint, we no longer need to cast to uint. That was the whole point of using native-sized integers in #3603. I believe something was missed there and the original author did not completely understand the change they were making.
Making the suggested change will fix
FromLowHighUnsigned_x32_Result
but will break another PARAM testFromLowHighUnsigned_x64_Result
because that test is currently expecting an incorrect result for one of its assertions.PARAMTests.FromLowHighUnsigned_x64_Result
The only thing using
Interop.PARAM.FromLowHighUnsigned()
currently is the TaskDialog to set its progress bar range. Its possible the overflow could be triggered from there somehow.I would appreciate to hear if the test System.Windows.Forms.Primitives.Tests.Interop.PARAMTests.FromLowHighUnsigned_x32_Result has been failing for anyone else and what your thoughts are.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions