Since value is a ref returned value, mutating it before returning was actually intended behaviour, since the reassignment causes the dictionary value to be mutated too.
Also, what game was this ref watching?!
* Explicit type is used where type is not evident.
* Conditions are inlined with a ternary and the return value is used directly.
* System.Runtime.InteropServices is only imported for .NET >= 6.0
The call to _To_Bits yields the result containing the same bytes, but not the same value. This value was then stored as-is into the parameter, which causes a conversion on how the value is stored, ultimately causing the wrong value to be written to the stream.
ReadSingle previously returned a double, and this never failed unit tests since float -> double is a widening conversion, with values being comparable.
Some of these directives were incorrectly written as #if NET6_0, when ThrowIfNull is available in all future versions too. The macro has been fixed to #if NET6_0_OR_GREATER.
For other methods, the branch has been introduced where it didn't exist before.
This isn't actually a "fix", the method may be slow by design if the source is lazily enumerated. SonarCloud, however, did not like this method not having an explicit timeout. If SonarCloud continues to complain, we'll just shut its mouth masking tape and throw it in the broom closet.
No integers >3 satisfy the condition of being odd AND not being a multiple of 3 (as checked above) AND not being in the form 6k ± 1. This condition never evaluates to true, and so the return is never reached and was preventing this method from hitting 100% code coverage.
This check was a defensive manoeuvrer in the event that the input is 0, but this condition has already been verified to be false with the switch guard clause.
This changes bumps coverage to 100% for Sqrt.