-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nullable decimal comparison bug in dotnet 8.0.5 (SDK 8.0.300) #73510
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics |
The comparison operator of nullables are synthesized by compiler: The difference of SDK version also suggests this. SDK 8.0.205 and 8.0.300 shares the same runtime version of 8.0.5, but different compiler versions. So this is probably a C# compiler bug for https://github.com/dotnet/roslyn. |
Switching to |
Do I need to repost this issue over to the roslyn repo? |
No, we're addressing it directly now. Thanks for the report! |
For us it did, but only after we updated to the most recent version (17.10.0). (that also installed sdk 8.0.300) |
Description
There is a change in how a null valued
decimal?
behaves in 8.0.5 compared to previous version of the sdk/runtime.I'm seeing the result of
nullDecimalVariable == 0.00m
to be equal totrue
in 8.0.5 (SDK 8.0.300) but wasfalse
in previous versions.Reproduction Steps
I created a simple new console application using
dotnet new console
and pasted the following code into it.I also added a global.json file to control which version of the dotnet SDK it was running against. I swapped between 8.0.205 and 8.0.300 which are the two versions of 8 I have installed. 8.0.205 was installed with visual studio, and I manually installed 8.0.300 via the SDK download to reproduce this bug.
I was only able to reproduce this using the command line
dotnet run
. Running in visual studio did not reproduce this issue. It is not only occurring on my machine. We had a test failure with the same root cause as this minimal repo on our two different dedicated build machines.Test.zip
Expected behavior
I expected
null == 0.00m
to return false as shown in 8.0.205Actual behavior
null == 0.00m
is returning true as shown in 8.0.300Regression?
Yes. I tried on the previous SDK version of 8.0.205 and it works.
Known Workarounds
No response
Configuration
Dotnet 8.0.5 (SDK 8.0.300)
System Information:
Edition Windows 11 Pro
Version 23H2
Installed on 4/15/2024
OS build 22631.3447
Experience Windows Feature Experience Pack 1000.22688.1000.0
Other information
No response
The text was updated successfully, but these errors were encountered: