- Home
- Forum
- Xamarin.Forms
- SfDataform crashed on binding
SfDataform crashed on binding
Hello,
I discovered very weird behaviour of the DataForm. I could not understand the reason why it crash every time we use two DataFormTextItem on the XAML.
If we use only one editor from two. It works.
If we let the form to auto generate Text editors, it works too.
I have a very basic setup to display a DataObject to the DataForm:
- Data object Code:
public class Foo
{
public Foo()
{
EmpName = "Foo Name";
DOB = "2019-02-26";
}
public string EmpName { get; set; }
public string DOB { get; set; }
}
2. Form XAML:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:sf ="clr-namespace:Syncfusion.XForms.DataForm;assembly=Syncfusion.SfDataForm.XForms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="DateCustomEditor.MainPage">
<ContentPage.Content>
<sf:SfDataForm x:Name="dataform" AutoGenerateItems="False" Margin="0,60,0,20">
<sf:SfDataForm.Items>
<sf:DataFormTextItem Name="EmpName" Editor="Text" ></sf:DataFormTextItem>
<sf:DataFormTextItem Name="DOB" Editor="Text" ></sf:DataFormTextItem>
<!--Uncomment one of two DataFormItem make the form works.-->
</sf:SfDataForm.Items>
</sf:SfDataForm>
</ContentPage.Content>
</ContentPage>
3. XAML binding
protected override void OnAppearing()
{
base.OnAppearing();
var _foo = new Foo();
dataform.DataObject = _foo;
}
Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Syncfusion.iOS.DataForm.Editors.DataFormEditor`1[EditorView].UnWireEvents (Syncfusion.iOS.DataForm.DataFormItem dataFormItem, UIKit.UIView view) [0x00036] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.iOS.DataForm.DataFormItemView.Dispose (System.Boolean isDisposing) [0x0003d] in <0918c5f150ff479494d5d783bad15235>:0
at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/Foundation/NSObject2.cs:147
at Syncfusion.iOS.DataForm.ScrollPanel.RemoveChildViews () [0x00072] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.iOS.DataForm.ScrollPanel.OnDataObjectChanged () [0x00000] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.iOS.DataForm.SfDataForm.OnDataObjectChanged (System.Object oldValue, System.Object newValue) [0x00029] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.iOS.DataForm.SfDataForm.set_DataObject (System.Object value) [0x00017] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.XForms.iOS.DataForm.SfDataFormMapping.SetDataFormProperties (System.String propertyName, Syncfusion.iOS.DataForm.SfDataForm nativeDataForm, Syncfusion.XForms.DataForm.SfDataForm dataForm) [0x00014] in <0918c5f150ff479494d5d783bad15235>:0
at Syncfusion.XForms.iOS.DataForm.SfDataFormViewRenderer.OnDataFormPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00022] in <0918c5f150ff479494d5d783bad15235>:0
at at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:211
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:359
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:443
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:379
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:293
at Syncfusion.XForms.DataForm.SfDataForm.set_DataObject (System.Object value) [0x00000] in <53a79c3ef26e487ea76e53887222bc24>:0
at DateCustomEditor.MainPage.OnAppearing () [0x0000e] in /Users/tung/Projects/DateCustomEditor/DateCustomEditor/MainPage.xaml.cs:27
at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:364
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidAppear (System.Boolean animated) [0x0004b] in <f0489d3941b24a20a5b9223b572ec7c0>:0
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at DateCustomEditor.iOS.Application.Main (System.String[] args) [0x00001] in /Users/tung/Projects/DateCustomEditor/DateCustomEditor.iOS/Main.cs:17
SIGN IN To post a reply.
3 Replies
AK
Ajith Kumar Senthil Kumar
Syncfusion Team
November 8, 2019 01:10 PM UTC
Hi Tung,
Thank you for contacting Syncfusion support.
Currently, we are analyzing your reported issue of “Getting null reference while using two DataFormTextItem on the XAML.” In Xamarin.Forms. We will validate and update you the further details in two business days (November 11, 2019). We appreciate your patience until then.
Regards,
Ajith
Ajith
AK
Ajith Kumar Senthil Kumar
Syncfusion Team
November 11, 2019 07:10 AM UTC
Hi Tung,
Thanks for your patience.
We have already found and fixed the issue “Getting null reference while using two DataFormTextItem on the XAML” and included the issue fix in our upcoming Weekly nuget, which is expected to publish on 12 November 2019. We appreciate your patience until then.
Regards,
Ajith
AK
Ajith Kumar Senthil Kumar
Syncfusion Team
November 12, 2019 11:39 AM UTC
Hi Tung,
We have fixed the reported issue “Getting null reference while using two DataFormTextItem on the XAML” and included the issue fix in our latest Weekly NuGet release update version 17.3.0.27 which is available for download (nuget.org).
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.
Regards,
Ajith
Ajith
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TU Tung
- Nov 8, 2019 01:29 AM UTC
- Nov 12, 2019 11:39 AM UTC