-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Behaviour of !! operator has changed in 11.1 #16071
Comments
"!!" wasn't a defined and documented feature before. I would recommend using more explicit ObjectConverters.IsNotNull. |
It was documented. From the link I posted above: "You can also use the negation operator twice. For example, where you want to perform the conversion from integer to Boolean, and then negate that value." This is not equivalent to any of the |
TIL, thanks. Either way, I agree that it's a regression.
True, I was referring specifically to the "null to boolean" conversion. |
Definitely looks like a regression introduced by the binding system refactor, will investigate. Not sure if this is a showstopper and needs to be fixed for 11.0.0 or whether it can wait for 11.0.1 though. |
We've decided that this issue is a serious enough regression that it necessitates an rc2. |
The previous design assumed that a source of `null` was an invalid input to all types of expression nodes. It turned out that there was a single exception to this rule: the `!` operator can in fact operate on a null value. With this new design we instead have to explicitly check for a null value in every override of `OnSourceChanged ` except in `LogicalNotNode`. Due to this change, we also have to distinguish between `null` and `(unset)` in `ExpressionNode.SetSource` as well. Fixes #16071
* Add tests for binding negation operator. Expected results come from 11.0.x branch. * Unset and null need to be distinct. Also remove `ExpressionNode.Reset` as it was doing unneeded stuff and should just be the same as `SetSource(AvaloniaProperty.UnsetValue, null);`. * Make ExpressionNode.OnSourceChanged accept null. The previous design assumed that a source of `null` was an invalid input to all types of expression nodes. It turned out that there was a single exception to this rule: the `!` operator can in fact operate on a null value. With this new design we instead have to explicitly check for a null value in every override of `OnSourceChanged ` except in `LogicalNotNode`. Due to this change, we also have to distinguish between `null` and `(unset)` in `ExpressionNode.SetSource` as well. Fixes #16071 * Fix comment.
* Add tests for binding negation operator. Expected results come from 11.0.x branch. * Unset and null need to be distinct. Also remove `ExpressionNode.Reset` as it was doing unneeded stuff and should just be the same as `SetSource(AvaloniaProperty.UnsetValue, null);`. * Make ExpressionNode.OnSourceChanged accept null. The previous design assumed that a source of `null` was an invalid input to all types of expression nodes. It turned out that there was a single exception to this rule: the `!` operator can in fact operate on a null value. With this new design we instead have to explicitly check for a null value in every override of `OnSourceChanged ` except in `LogicalNotNode`. Due to this change, we also have to distinguish between `null` and `(unset)` in `ExpressionNode.SetSource` as well. Fixes #16071 * Fix comment.
I've confirmed that this issue is fixed for me in 11.1.0-RC2. |
Describe the bug
The behaviour of the double-negation operator (
!!
) has changed between 11.0.10 and 11.1.0-rc1.Consider the binding
{Binding !!Value}
, whereValue
isnull
. In 11.0.10 this binding yieldsfalse
. In 11.1.0-rc1 the same binding yieldsnull
. This is a breaking change for my application.To Reproduce
MainWindow.axaml
MainWindowViewModel.cs
Steps to reproduce:
Expected behavior
Avalonia 11.0.10 displays:
Avalonia version
11.1.0-rc1
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: