ImageEditor crash on iOS? [MauiContext should have been set on parent]

1 Answer 123 Views
ImageEditor
Shane
Top achievements
Rank 1
Shane asked on 10 Jan 2024, 06:46 PM

  I wanted to know if there were any known issues with the ImageEditor on iOS? In the documentation it had examples on android and windows but nothing for iOS. And then i get the crash (Down below) stating a maui context issue.

~ Additional info 

I have the ImageEditor in a 'mopup' page to act as a popup. 

The styling on the editor is only affecting TextColor                                            

simulator(built on x64)  and physical devices 

iOS 17 

.NET8

 

<Grid Grid.Row="0">
                  <Grid.RowDefinitions>
                      <RowDefinition Height="*"/>
                      <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>

                  <telerik:RadImageEditor
                      x:Name="imageEditor"
                      Padding="10" />

                  <telerik:RadImageEditorToolbar
                      Grid.Row="1"
                      AutoGenerateItems="False"
                      ImageEditor="{x:Reference imageEditor}">
                      <telerik:ImageEditorRotateLeftToolbarItem Style="{StaticResource buttonToolbarStyle}" />
                      <telerik:ImageEditorRotateRightToolbarItem Style="{StaticResource buttonToolbarStyle}" />
                      <telerik:ImageEditorUndoToolbarItem Style="{StaticResource buttonToolbarStyle}" />
                      <telerik:ImageEditorRedoToolbarItem Style="{StaticResource buttonToolbarStyle}" />
                      <telerik:ButtonToolbarItem
                          x:Name="SaveToolBar"
                          Clicked="OnSaveTapped"
                          IsEnabled="True"
                          IsVisible="True"
                          Style="{StaticResource buttonStyle}"
                          Text="Save" />
                  </telerik:RadImageEditorToolbar>
              </Grid>

1st crash message 
System.InvalidOperationException: 'Loading...'

 

follow up crash messages / detailed log 

ObjCRuntime.ObjCException: 'Objective-C exception thrown.  Name: System.InvalidOperationException Reason: MauiContext should have been set on parent. (System.InvalidOperationException)
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view)
   at Microsoft.Maui.Handlers.LayoutHandler.Remove(IView child)
   at Microsoft.Maui.Handlers.LayoutHandler.MapRemove(ILayoutHandler handler, ILayout layout, Object arg)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.ILayoutHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)
   at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
   at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
   at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.RemoveAt(Int32 index)
   at Microsoft.Maui.Controls.Layout.Remove(IView child)
   at Telerik.Maui.Controls.ImageEditor.BusyService.HideBusyIndicatorCore()
   at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass9_0.<DispatchImplementation>b__0()
   at CoreFoundation.DispatchQueue.static_dispatcher_to_managed(IntPtr context) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreFoundation/Dispatch.cs:line 379
   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 58
   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 MyApp.Program.Main(String[] args) in C:\Development\Xamarin Field Clients\MyApp\MyApp\Platforms\iOS\Program.cs:line 13

Native stack trace:
0   CoreFoundation                      0x0000000113ce728d __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x000000012a18c894 objc_exception_throw + 48
2   libxamarin-dotnet-debug.dylib       0x000000010e8d9fe6 xamarin_process_managed_exception + 934
3   libxamarin-dotnet-debug.dylib       0x000000010e8d9b8b xamarin_process_managed_exception_gchandle + 59
4   libxamarin-dotnet-debug.dylib       0x000000010e8d9b45 xamarin_ftnptr_exception_handler + 21
5   libmonosgen-2.0.dylib               0x000000010fdd1d77 mono_handle_exception_internal + 6199
6   libmonosgen-2.0.dylib               0x000000010fdd0535 mono_handle_exception + 21
7   libmonosgen-2.0.dylib               0x000000010fe48389 interp_throw + 185
8   libmonosgen-2.0.dylib               0x000000010fe464dc interp_throw_ex_general + 188
9   libmonosgen-2.0.dylib               0x000000010fe40705 mono_interp_exec_method + 38437
10  libmonosgen-2.0.dylib               0x000000010fe48f65 interp_entry + 453
11  libmonosgen-2.0.dylib               0x000000010fe49797 interp_entry_static_1 + 55
12  ???                                 0x000000010d73b924 0x0 + 4520655140
13  libdispatch.dylib                   0x0000000130899ac0 _dispatch_main_queue_drain + 1420
14  libdispatch.dylib                   0x0000000130899526 _dispatch_main_queue_callback_4CF + 31
15  CoreFoundation                      0x0000000113c43850 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
16  CoreFoundation                      0x0000000113c3e18b __CFRunLoopRun + 2463
17  CoreFoundation                      0x0000000113c3d409 CFRunLoopRunSpecific + 557
18  GraphicsServices                    0x00000001322be187 GSEventRunModal + 137
19  UIKitCore                           0x00000001437583a2 -[UIApplication _run] + 972
20  UIKitCore                           0x000000014375ce10 UIApplicationMain + 123
21  libxamarin-dotnet-debug.dylib       0x000000010e8a94da xamarin_UIApplicationMain + 58
22  libmonosgen-2.0.dylib               0x000000010fe48bc5 do_icall + 341
23  libmonosgen-2.0.dylib               0x000000010fe47357 do_icall_wrapper + 295
24  libmonosgen-2.0.dylib               0x000000010fe38076 mono_interp_exec_method + 3990
25  libmonosgen-2.0.dylib               0x000000010fe357e3 interp_runtime_invoke + 259
26  libmonosgen-2.0.dylib               0x000000010ff1b908 mono_runtime_invoke_checked + 136
27  libmonosgen-2.0.dylib               0x000000010ff230db mono_runtime_exec_main_checked + 107
28  libmonosgen-2.0.dylib               0x000000010fd87f52 mono_jit_exec + 354
29  libxamarin-dotnet-debug.dylib       0x000000010e8edbba xamarin_main + 1898
30  MyApp                               0x000000010482f114 main + 68
31  dyld                                0x000000010d4653ee start_sim + 10
32  ???                                 0x00000002052e73a6 0x0 + 8676864934
'

1 Answer, 1 is accepted

Sort by
0
Accepted
Didi
Telerik team
answered on 15 Jan 2024, 09:42 AM

Hello Shane,

I can assure you that the ImageEditor control works on iOS. You can check this by downloading the Telerik Controls Samples application from the App Store and test the control. 

All known issues for ImageEditor are logged here: https://feedback.telerik.com/maui/search?typeId=3&listMode=Search&searchTerm=imageeditor The mentioned crash has not been reported before. 

I would like to ask you to send me a sample project where the issue occurs. I am asking for this as you mentioned a mopup control/page. The behavior could be somehow related to the usage of this mopup page. 

If you do not want to send the project to the forum, you can open a support ticket and attach the project to it.

Looking forward to your reply.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Shane
Top achievements
Rank 1
commented on 17 Jan 2024, 02:53 PM

Hello Didi

Attached is not my orininal project but something i whipped up just to recreate the issue. I would say this is probably a bug with the mopup nuget package but you guys can take a look into it if you want!

Additionally if anyone else has run into this issue i have a found a workaround where you can still use a 'popup'. Just use the maui community toolkit popup implementation instead.

Thanks

Shane

Tags
ImageEditor
Asked by
Shane
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or