ImageEditor Crashes when Cropping

7 posts, 0 answers
  1. Vuyiswa
    Vuyiswa avatar
    217 posts
    Member since:
    Jan 2010

    Posted 05 Jul Link to this post

    Good Day  

    The imageEditor after loading the image , other Toolbar items work nicely but the cropping which put a cross on the centre of the image. crashes when you try to adjust the image with an error 

     

    Unhandled Exception:

    System.ArgumentException: An item with the same key has already been added. Key: 0

     

    Thanks

  2. Didi
    Admin
    Didi avatar
    250 posts

    Posted 08 Jul Link to this post

    Hi Vuyiswa,

    I have tried to reproduce the exception on my side but the cropper item works as expected.

    Next Steps:

    Could you please send us the following information: 

    - a video how the cropper is used
    - a sample where the issue could be reproduced? Note that you should open a support ticket and attach the project there, because in the forum only image attachments are allowed.
    - versions of Xamarin.Forms and Telerik UI for Xamarin used in the project.
    - the full stack trace of the exception.

    Thank you in advance and I am looking forward to your reply. 

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Vuyiswa
    Vuyiswa avatar
    217 posts
    Member since:
    Jan 2010

    Posted 19 Oct in reply to Didi Link to this post

    Good Day 

    Sorry for taking time return to this 

    Here is a xaml for the screen 

     

    <ScrollView>
     
                <StackLayout>
                <StackLayout>
                        <telerikImageEditor:RadImageEditor  HeightRequest="300"   x:Name="imageEditor" Source="placeholder.jpg">
                    </telerikImageEditor:RadImageEditor>
                    <telerikImageEditor:RadImageEditorToolbar BackgroundColor="white" ImageEditor="{x:Reference imageEditor}" />
                    <StackLayout Orientation="Horizontal" HorizontalOptions="Center" Padding="10,10,10,20" Spacing="10">
                            <telerikInput:RadButton  
                             BackgroundColor="#FE9556" TextColor="White"  Image="ic_tinder_browse.png"  WidthRequest="60" HeightRequest="60" CornerRadius="30"
                                  
                                Clicked="Button_Clicked"/>
                            <telerikInput:RadButton  x:Name="btnmakeprofilepic" Clicked="Btnmakeprofilepic_Clicked"
                             BackgroundColor="#FE9556" TextColor="White"  Image="profile_pic_final.png"  WidthRequest="60" HeightRequest="60" CornerRadius="30"
                                  
                            />
                            <telerikInput:RadButton 
                                HorizontalOptions="Center" BackgroundColor="#FE9556" TextColor="White"    WidthRequest="60" HeightRequest="60" CornerRadius="30"
                               Image="save_white.png"
                                Clicked="Button_Clicked_1"/>
                    </StackLayout>
                </StackLayout>
                    <telerikInput:RadButton Margin="20,20,20,20" BackgroundColor="#FE9556" TextColor="White"
                        Clicked="Button_Clicked_2"
                        Text="Show Photo Gallery"
                        VerticalOptions="Center" />
     
                     
                </StackLayout>
                
            </ScrollView>
     
    and when i try to crop it creshes, on the output window i see this

     

    **System.ArgumentException:** 'An item with the same key has already been added. Key: 0'

    10-19 08:16:06.742 I/MonoDroid(11720): UNHANDLED EXCEPTION:
    10-19 08:16:06.744 I/MonoDroid(11720): System.ArgumentException: An item with the same key has already been added. Key: 0
    10-19 08:16:06.744 I/MonoDroid(11720):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.71(intptr,intptr,intptr,intptr)
    10-19 08:16:06.744 I/MonoDroid(11720):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.71(intptr,intptr,intptr,intptr)
    10-19 08:16:06.745 I/MonoDroid(11720):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_boolean_method_a(intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*)
    10-19 08:16:06.745 I/MonoDroid(11720):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00073] in <212d71eb7ebe48a08a28594a6b73aa4b>:0 
    10-19 08:16:06.745 I/MonoDroid(11720):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <212d71eb7ebe48a08a28594a6b73aa4b>:0 
    10-19 08:16:06.745 I/MonoDroid(11720):   at Android.Views.View.DispatchTouchEvent (Android.Views.MotionEvent e) [0x00027] in /Users/builder/jenkins/workspace/xamarin-android-commercial/xamarin-android/src/Mono.Android/obj/Release/android-27/mcw/Android.Views.View.cs:13592 
    10-19 08:16:06.745 I/MonoDroid(11720):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].DispatchTouchEvent (Android.Views.MotionEvent e) [0x00012] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:64 
    10-19 08:16:06.745 I/MonoDroid(11720):   at Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00011] in /Users/builder/jenkins/workspace/xamarin-android-commercial/xamarin-android/src/Mono.Android/obj/Release/android-27/mcw/Android.Views.View.cs:13579 
    10-19 08:16:06.745 I/MonoDroid(11720):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr,intptr)

     

    Thanks 

     

  4. Didi
    Admin
    Didi avatar
    250 posts

    Posted 21 Oct Link to this post

    Hello Vuyiswa,

    Thank you for the provided details.

    I have created a sample based on it and I could not reproduce the issue on my side. Could you please download the attached sample and test it on your side?

    Further assistance:

    May I ask you to modify the attached file regarding your setup and send it back to me? Please verify that the project crashes on your side. Note that you should open a support ticket and attach the project there because in the forum only image attachments are allowed.

    Additional information

    - a video how the cropper is used
    - versions of Xamarin and Telerik used in the project
    - on which Android device/emulator and SDK version the issue occurs

    Thank you in advance and I look forward to your reply.

    Regards,
    Didi
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Vuyiswa
    Vuyiswa avatar
    217 posts
    Member since:
    Jan 2010

    Posted 22 Oct in reply to Didi Link to this post

    hi Admin 

    There are two issues , i am using 2019.2.619.360 Assemblies , included Skia Libs.  

    Test phone Xiomi Redmi 4A

    Issue 1

    Run the Project you sent me, before you click the Edit , do as if you swipe on the photo and after that tap the photo. The app will crush.

     Issue 2

    Click on the Crop toolbar item and try to adjust the size of the image that needs to be cropped. it crashes.

    Thanks 

     

     

  6. Vuyiswa
    Vuyiswa avatar
    217 posts
    Member since:
    Jan 2010

    Posted 22 Oct in reply to Vuyiswa Link to this post

    Issue 2 link
  7. Didi
    Admin
    Didi avatar
    250 posts

    Posted 24 Oct Link to this post

    Hi Vuyiswa,

    Please note that I have removed the links from the forum. I would like to ask you not to add links in our forum in such a way. If you would like to send us a project/video you have to open a support ticket and attach the files there. In the forum only image attachments are allowed. 

    Regarding to the issue I cannot reproduce it on my side. I have tested on Xiaomi Redmi 6A. I suggest you update the Telerik UI for Xamarin suite to the latest available version 2019.3.1023.1 and check whether the issue will be resolved. I have noticed that you have positioned the ImageEditor inside a ScrollView, please avoid this, as the gestures for the Crop feature are triggered from the ScrollView not from the ImageEditor.

    If the issue still occurs with the latest Telerik version then as a next step you should open a support ticket and attach a sample project to it.

    Regards,
    Didi
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top