We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataFormDropDownItem crashes app

Hello,
I'm usingDataFormItemManager to add DataFormItem to the form.
Adding DataFormPickerItem orDataFormDropDownItem causes crash below:
Please advise.
at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x00003] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/external/corefx/src/System.Linq/src/System/Linq/First.cs:79
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/external/corefx/src/System.Linq/src/System/Linq/First.cs:37
at Syncfusion.XForms.DataForm.Editors.DataFormDropDownEditor.OnUpdateValue (Syncfusion.XForms.DataForm.DataFormItem dataFormItem,
Syncfusion.XForms.ComboBox.SfComboBox view) [0x000b5] in <3d98a3bdfb544be283918442453a0227>:0
at Syncfusion.XForms.DataForm.Editors.DataFormDropDownEditor.OnInitializeView (Syncfusion.XForms.DataForm.DataFormItem dataFormItem, Syncfusion.XForms.ComboBox.SfComboBox view) [0x00030] in <3d98a3bdfb544be283918442453a0227>:0
at Syncfusion.XForms.DataForm.Editors.DataFormEditor`1[EditorView].InitializeView (Syncfusion.XForms.DataForm.DataFormItem dataFormItem, Xamarin.Forms.View view) [0x00050] in <3d98a3bdfb544be283918442453a0227>:0
at Syncfusion.iOS.DataForm.DataFormLayoutManager.CreateDataFormItemTextInputLayout (System.Int32 rowIndex, System.Int32 columnIndex) [0x000dc] in <52c84fe9325a4f308b11ab9cd3b47aec>:0
at Syncfusion.iOS.DataForm.DataFormLayoutManager.CreateItemView (System.Int32 rowIndex, System.Int32 columnIndex) [0x00049] in <52c84fe9325a4f308b11ab9cd3b47aec>:0
at Syncfusion.iOS.DataForm.ScrollPanel.GenerateItems (System.Int32 columnCount, System.Int32& actualStartIndex, System.Int32 actualEndIndex) [0x00069] in <52c84fe9325a4f308b11ab9cd3b47aec>:0
at Syncfusion.iOS.DataForm.ScrollPanel.OnLayoutViews () [0x00215] in <52c84fe9325a4f308b11ab9cd3b47aec>:0
at Syncfusion.iOS.DataForm.ScrollPanel.LayoutSubviews () [0x00000] in <52c84fe9325a4f308b11ab9cd3b47aec>:0
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/12.14.0.114/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/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:65

Attachment: FormLayout_d38506d.rar

4 Replies

KA Karthikraja Arumugam Syncfusion Team September 16, 2019 12:52 PM UTC

Hi Tung, 
 
Thank you for contacting Syncfusion support. 
 
Query 1: DataFormDropDownItem and DataFormPickerItem crash with custom DataFormItemManager class 
Based on the shared information we have checked the issue and from your sample, we found that you are trying to set ItemsSource for both items using SourceProvider but while creating DataFormItems through DataFormItemManger class you need to provide ItemsSource for DropDown and Picker items explicitly.  
 
Please refer the following code example for the same,    
 
[C#]       
 
//DataFormPickerItem 
  dataFormItem = new DataFormPickerItem() { Name = propertyInfo.Key, DisplayMemberPath = "Description", ValueMemberPath = "Code", Editor = "Picker", ItemsSource = this.GetItemSource("CustomerGroup") }; 
 
 
//DataFormDropDownItem 
dataFormItem = new DataFormDropDownItem() { Name = propertyInfo.Key, DisplayMemberPath = "Description", SelectedValuePath = "Code", Editor = "DropDown" , ItemsSource = this.GetItemSource("CustomerGroup") }; 
 
 
private IList GetItemSource(string sourceName) 
{ 
            var list = new List<SimpleInfo>(); 
            if (sourceName == "CustomerGroup") 
            { 
                list.Add(new SimpleInfo() { Code = "", Description = "No Group" }); 
                list.Add(new SimpleInfo() { Code = "W", Description = "W. Wholesales" }); 
                list.Add(new SimpleInfo() { Code = "O", Description = "O. Online" }); 
                list.Add(new SimpleInfo() { Code = "R", Description = "R. Retails" }); 
 
            } 
            return list; 
  } 
 
We have modified your sample for the same, 
Sample link: FormLayout 
 
 
Query 2: DataFormDropDown item inside the floating label layout 
As of now, DataForm FloadtingLabel layout doesn’t have support for DataFormDropDownItem. We have already planned to include DropDownItem inside floating label layout and currently which is in the implementation phase, we will include this new feature in our upcoming Volume 3 release. Which is expected to roll out at the end of September 2019. 
 
As of now you can use DropDownItem inside default layout. DataForm supports to change layout option for each item. Kindly refer our UG documentation for the same 
  
Please refer the following code example for the same,  
 
[C#]       
//DataFormDropDownItem 
dataFormItem = new DataFormDropDownItem() { Name = propertyInfo.Key, DisplayMemberPath = "Description", SelectedValuePath = "Code", Editor = "DropDown" , ItemsSource = this.GetItemSource("CustomerGroup"), LayoutOptions = LayoutType.Default }; 
 
We hope this helps. Please let us know, if you need any further assistance. 
 
Regards, 
Karthik Raja A 



TU Tung September 21, 2019 05:27 AM UTC

Hello,

I have check with the modified sample from you.

The Combobox works, when the picker is still throwing exception:

  at System.Linq.Expressions.Expression.FindMethod (System.Type type, System.String methodName, System.Type[] typeArgs, System.Linq.Expressions.Expression[] args, System.Reflection.BindingFlags flags) [0x0008c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:1330 
  at System.Linq.Expressions.Expression.Call (System.Type type, System.String methodName, System.Type[] typeArguments, System.Linq.Expressions.Expression[] arguments) [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:1181 
  at Syncfusion.iOS.DataForm.QueryableExtensions.Select (System.Linq.IQueryable source, System.String propertyName, System.Type sourceType) [0x0006a] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.QueryableExtensions.Select (System.Linq.IQueryable source, System.String propertyName) [0x00007] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.Editors.SfPicker.RefreshItems () [0x00091] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.Editors.SfPicker.OnItemsSourceChanged (System.Collections.IEnumerable oldVaue) [0x00073] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.Editors.SfPicker.LoadPicker () [0x00008] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.Editors.SfPicker.WillMoveToWindow (UIKit.UIWindow window) [0x0000a] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr(intptr,intptr,intptr)
  at UIKit.UIView.AddSubview (UIKit.UIView view) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/UIKit/UIView.g.cs:273 
  at Syncfusion.iOS.DataForm.ScrollPanel.LayoutChildViews (System.Int32 columnCount, System.Int32& rowIndex, System.Int32 actualEndIndex, System.nfloat& ypos) [0x0013f] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.ScrollPanel.OnLayoutViews () [0x002b2] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  at Syncfusion.iOS.DataForm.ScrollPanel.LayoutSubviews () [0x00000] in <52c84fe9325a4f308b11ab9cd3b47aec>:0 
  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/12.14.0.114/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/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at FormLayout.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\tung\source\repos\FormLayout\FormLayout.iOS\Main.cs:17 


KA Karthikraja Arumugam Syncfusion Team September 23, 2019 12:42 PM UTC

Hi Tung, 
 
Thank you for the update. 
 
Currently, we are validating the mentioned issue in DataForm with Complex DataFormPickerItem. We will check and update you further details on or before September 25, 2019. We appreciate your patience until then. 
 
Regards, 
Karthik Raja A 



KA Karthikraja Arumugam Syncfusion Team September 25, 2019 10:25 AM UTC

Hi Tung, 
 
Thank you for your patience. 
 
We have checked the mentioned issue with DataForm complex PickerItem. We are using System.Linq.Queryable to get ItemsSource of complex picker, while Linker behavior in iOS project set other than Don’t Link, compiler skips System.Linq.Queryable package, hence it throws an exception. We are facing framework level issue while trying to resolve this exception in source level so we have logged an issue report for the same with Xamarin team. 
 
Kindly refer the following link for the same: 
 
Once we get the solution from the Forum we will change our implementation which will resolve this exception. We appreciate your patience until then. 
 
As of now, this can be resolved at the sample level. 
Solution 1: Additional mtouch arguments 
In the properties of your iOS project, add the following to 'Additional mtouch arguments' 
 --linkskip=System.core.   
 
Please refer the following step, 
 
 
iOS project -> Properties -> iOS Build -> Additional mtouch arguments -> add --linkskip=System.core 
 
Kindly refer Linking Xamarin.iOS Apps for more information. 
 
Solution 2: Preserve System.Linq.Queryable 
In your iOS project Main.cs file add preserve attribute before the namespace. 
 
Please refer the following code example for the same, 
 
[c#] 
[assembly: Preserve(typeof(System.Linq.Queryable), AllMembers = true)] 
namespace FormLayout.iOS 
{ 
    public class Application 
    { 
        // This is the main entry point of the application. 
    } 
} 
 
We have modified your sample based on your requirement, 
 
Sample link: FormLayout 
 
We are facing issue with Framework level while trying to achieve solution at our source level.  
 
Regards, 
Karthik Raja A 


Loader.
Live Chat Icon For mobile
Up arrow icon