uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[iOS][DevExpress MAUI Embedding][DataGridView] ObjCRuntime.RuntimeException when using CheckBoxColumn or TemplateColumn

Open agneszitte opened this issue 1 year ago • 1 comments

Current behavior

When testing DevExpress DataGridView control in an Uno Platform application with MAUI Embedding, ObjCRuntime.RuntimeException is thrown when using CheckBoxColumn or TemplateColumn for the columns on iOS.

  • For CheckBoxColumn:

    bjCRuntime.RuntimeException
     Message=Unable to marshal the parameter unoplatform/uno#1 whose managed type is 'UIKit.UIView' to managed.
    dditional information:
    Selector: onSelectionChanged:andRowIndex:andCellIndex:
    Method: DevExpress.Maui.DataGrid.iOS.Internal.GridActionDelegate:OnSelectionChanged (UIKit.UIView,int,int)
    
     Source=Microsoft.iOS
     StackTrace:
      at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
      at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
      at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
      at DevExpressApp.iOS.EntryPoint.Main(String[] args) in C:\Dev\Samples\Maui Embedding\DevExpress\Cli\DevExpressApp\DevExpressApp\Platforms\iOS\Main.iOS.cs:line 12
    

    Related CallStack:

    	0x28 in ObjCRuntime.Runtime.ThrowException at /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:2594,4	C#
    	0x23 in UIKit.UIApplication.UIApplicationMain at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:60,4	C#
    	0x51 in UIKit.UIApplication.Main at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:94,4	C#
    	0xD in DevExpressApp.iOS.EntryPoint.Main at C:\Dev\Samples\Maui Embedding\DevExpress\Cli\DevExpressApp\DevExpressApp\Platforms\iOS\Main.iOS.cs:12,9	C#
    
  • For TemplateColumn:

    bjCRuntime.ObjCException
     Message=Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[__NSTaggedDate then:]: unrecognized selector sent to instance 0xe6309863a1ab0016
    ative stack trace:
    0   CoreFoundation                      0x00007ff8004cd531 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff8000837e8 objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff8004e2643 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x00007ff8004d1cc4 ___forwarding___ + 1459
    4   CoreFoundation                      0x00007ff8004d3ec8 _CF_forwarding_prep_0 + 120
    5   DXGrid                              0x000000010dd8f98d -[DXGridCellView updateValue:] + 504
    6   DXGrid                              0x000000010ddb4d32 -[DXGridRowView updateVisibleViews:] + 341
    7   DXGrid                              0x000000010dd94dc8 -[DXGridRowViewProvider updateView:withIndex:updateData:] + 125
    8   DXGrid                              0x000000010ddaaef9 -[RowPanel getLayoutItemByIndex:scrollingDown:forceUpdate:] + 401
    9   DXGrid                              0x000000010ddabbaf -[RowPanel addElementByIndex:toEnd:forceUpdate:andTopDownOrder:] + 40
    10  DXGrid                              0x000000010ddaa10d -[RowPanel layoutRowsFromOffset:andIndex:andScrollingDown:andAverageHeight:andForceUpdate:andTopDownOrder:] + 579
    11  DXGrid                              0x000000010dda9ebb -[RowPanel updateVisibleViews:andKeepOldItems:andForceUpdate:andTopDownOrder:] + 216
    12  DXGrid                              0x000000010ddb296e -[PanelBase updateActualFrame] + 153
    13  DXGrid                              0x000000010dda9dbf -[RowPanel setFrame:] + 59
    14  DXGrid                              0x000000010dd9bb6e -[DXGridView layoutSubviews] + 1139
    15  UIKitCore                           0x00007ff8063a477c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2138
    16  QuartzCore                          0x00007ff80b18e261 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 527
    17  QuartzCore                          0x00007ff80b19a08d _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 67
    18  QuartzCore                          0x00007ff80b0b9200 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 706
    19  QuartzCore                          0x00007ff80b0f3d3a _ZN2CA11Transaction6commitEv + 728
    20  UIKitCore                           0x00007ff805ce0227 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 34
    21  CoreFoundation                      0x00007ff800429daa __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    22  CoreFoundation                      0x00007ff80042955d __CFRunLoopDoBlocks + 391
    23  CoreFoundation                      0x00007ff800423e3c __CFRunLoopRun + 940
    24  CoreFoundation                      0x00007ff8004236ad CFRunLoopRunSpecific + 557
    25  GraphicsServices                    0x00007ff8103da08f GSEventRunModal + 137
    26  UIKitCore                           0x00007ff805cc0ad1 -[UIApplication _run] + 972
    27  UIKitCore                           0x00007ff805cc5551 UIApplicationMain + 123
    28  libxamarin-dotnet-debug.dylib       0x000000010e1ca4ca xamarin_UIApplicationMain + 58
    29  libmonosgen-2.0.dylib               0x000000010f5b5345 do_icall + 341
    30  libmonosgen-2.0.dylib               0x000000010f5b3ad7 do_icall_wrapper + 295
    31  libmonosgen-2.0.dylib               0x000000010f5a47f6 mono_interp_exec_method + 3990
    32  libmonosgen-2.0.dylib               0x000000010f5a1f63 interp_runtime_invoke + 259
    33  libmonosgen-2.0.dylib               0x000000010f6882d8 mono_runtime_invoke_checked + 136
    34  libmonosgen-2.0.dylib               0x000000010f68fc1b mono_runtime_exec_main_checked + 107
    35  libmonosgen-2.0.dylib               0x000000010f4f4742 mono_jit_exec + 354
    36  libxamarin-dotnet-debug.dylib       0x000000010e20ebea xamarin_main + 1898
    37  DevExpressApp                       0x000000010c5db9d4 main + 52
    38  dyld                                0x000000010d3023e0 start_sim + 10
    39  ???                                 0x0000000110739366 0x0 + 4570977126
    
     Source=Microsoft.iOS
     StackTrace:
      at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
      at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
      at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
      at DevExpressApp.iOS.EntryPoint.Main(String[] args) in C:\Dev\Samples\Maui Embedding\DevExpress\Cli\DevExpressApp\DevExpressApp\Platforms\iOS\Main.iOS.cs:line 12
    

    Related CallStack:

    	0x28 in ObjCRuntime.Runtime.ThrowException at /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:2594,4	C#
    	0x23 in UIKit.UIApplication.UIApplicationMain at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:60,4	C#
    	0x51 in UIKit.UIApplication.Main at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:94,4	C#
    	0xD in DevExpressApp.iOS.EntryPoint.Main at C:\Dev\Samples\Maui Embedding\DevExpress\Cli\DevExpressApp\DevExpressApp\Platforms\iOS\Main.iOS.cs:12,9	C#
    

Expected behavior

No exceptions and no crashes for the app like for Android.

How to reproduce it (as minimally and precisely as possible)

  • Follow the documentation for DevExpress to use the DataGrid with MAUI Embedding
  • Launch the application and notice no exceptions for iOS and Android, everything is displaying well.
  • Add a CheckBoxColumn or TemplateColumn in the DataGridView
  • Launch the application for Android, no exceptions everything is displaying well.
  • Launch the application for iOS, notice the ObjCRuntime.RuntimeException, and the app crashes after that. -- Sample repro app: DevExpressApp.zip
  • Uncomment the CheckBoxColumn or TemplateColumn in the DataGridView in EmbeddedControl.xaml
  • Launch the application for iOS, notice the ObjCRuntime.RuntimeException, and the app crashes after that.

Workaround

None at the moment

Works on UWP/WinUI

None (Only compatible with Android and iOS)

Environment

Uno.Sdk

NuGet package version(s)

  • Uno.Sdk: "Uno.Sdk": "5.2.132" OR "Uno.Sdk": "5.3.0-dev.1877"
  • Uno.Extensions: <UnoExtensionsVersion>4.1.23</UnoExtensionsVersion> OR <UnoExtensionsVersion>4.2.0-dev.81</UnoExtensionsVersion>
  • DevExpress.Maui.DataGrid: Version 23.2.5 OR Version 23.2.6 OR Version 24.1.2-beta
  • Maui version: 8.0.21

Affected platforms

iOS

IDE

Visual Studio 2022

IDE version

17.10.1

Relevant plugins

N/A

Anything else we need to know?

No exception when testing the same code with a maui sample application using DevExpress.Maui.DataGrid version 23.2.6 and Maui version 8.0.21. (DevExpress-Examples maui-DataGridExample.zip)

Related sample code: https://github.com/DevExpress-Examples/maui-data-grid/tree/23.2.3%2B/CS/DataGridExample

agneszitte avatar Jun 06 '24 21:06 agneszitte