XToolkit.WhiteLabel icon indicating copy to clipboard operation
XToolkit.WhiteLabel copied to clipboard

Bindings null-values cause crash

Open TimofeyBurak opened this issue 5 years ago • 0 comments

Description

It would be more convenient if Bindings will use some kind of null-propagation: if one of the properties in the expression is null - then the value of the source would consider null

Steps to Reproduce

  1. Create ViewModel for screen
  2. Implement SubViewModel class with string Message
  3. Add property of type SubViewModel to screen ViewModel
  4. Set SubViewModel to null by default
  5. Apply binding like following this.Bind(() => ViewModel.SubViewModel.Message, () => Label.Text)

Expected Behavior

Source value (ViewModel.SubViewModel.Message) is interpreted as null, so target property (Label.Text) is set to null. Also, as SubViewModel value is changed - Binding should react and recalculate source value

Actual Behavior

NullReferenceException, as expression () => ViewModel.SubViewModel.Message is used to calculate source value

Basic Information

  • Version with issue: doesn't seem like we tracking versions, really.. latest master
  • Last known good version: none
  • IDE: JetBrains Rider 2019.3.3
  • Platform Target Frameworks:
    • iOS: 11.0

TimofeyBurak avatar Mar 02 '20 11:03 TimofeyBurak