Bug 40435

Summary: Entry on UWP crashing with nullreference exception Xamarin.Forms V2.2.0-pre2
Product: Forms Reporter: FieldstrikeMobile
Component: FormsAssignee: Bugzilla <bugzilla>
Status: VERIFIED FIXED    
Severity: normal CC: ehart, jas, parmendrak, sahou
Priority: ---    
Version: 2.2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Windows ac Is this bug a regression?: ---
Last known good build:

Description FieldstrikeMobile 2016-04-15 14:04:44 UTC
I cant get a simple sample toghether that will replicate the bug but when using an Entry control on UWP it seems I am a

NullReferenceException

from this method:

    private void OnNativeTextChanged(object sender, TextChangedEventArgs args)
    {
      this.Element.SetValueCore(Entry.TextProperty, (object) this.Control.Text, BindableObject.SetValueFlags.None);
    }


I'd imagine this would need some defensive coding like UpdateFont()

    private void UpdateFont()
    {
      if (this.Control == null)
        return;
      Entry element = this.Element;
      if (element == null)
        return;

      ....
    }
Comment 1 FieldstrikeMobile 2016-04-15 14:59:23 UTC
For example if you look at the EditorRenderer on UWP it has the following method:

    private void OnNativeTextChanged(object sender, TextChangedEventArgs args)
    {
      Editor element = this.Element;
      if (element == null)
        return;
      BindableProperty property = Editor.TextProperty;
      string text = this.Control.get_Text();
      int num = 0;
      element.SetValueCore(property, (object) text, (BindableObject.SetValueFlags) num);
    }

and I imagine EntryRenderer needs to be coded in the same way
Comment 2 FieldstrikeMobile 2016-04-15 15:08:33 UTC
To clarify I know it is the OnNativeTextChanged method that is throwing the nullreferenceexception on UWP because of the stack trace
Comment 3 Samantha Houts [MSFT] 2016-04-19 07:17:45 UTC
Should be fixed in 2.2.0-pre3. Thank you!
Comment 4 Parmendra Kumar 2016-04-25 18:19:00 UTC
To verify this issue I have tried to reproduce this issue but not able to reproduce this issue.

Could you please provide me a small sample project? so that I can verify this issue efficiently. 

Thanks.
Comment 5 FieldstrikeMobile 2016-04-26 07:40:01 UTC
@Parnmendra I tested this with my application and I can verify that this bug is fixed in 2.2.0 pre 3
Comment 6 FieldstrikeMobile 2016-04-26 07:40:19 UTC
@Parnmendra I tested this with my application and I can verify that this bug is fixed in 2.2.0 pre 3