ObjectDisposedException on navigation back

Hi,

I am getting the exception below when I am navigating away from a page that contains an SfImageEditor (version 16.1.0.26). The SfimageEditor has an image loaded and I have a button that saves the image and navigates away (goes back) from that page. I am navigating away from the ImageSaved event handler:

03-27 16:01:50.344 D/Mono (27996): Probing '__android_log_print'.
03-27 16:01:50.345 D/Mono (27996): Found as '__android_log_print'.
03-27 16:01:50.350 I/MonoDroid(27996): UNHANDLED EXCEPTION:
03-27 16:01:50.372 I/MonoDroid(27996): System.ObjectDisposedException: Cannot access a disposed object.
03-27 16:01:50.372 I/MonoDroid(27996): Object name: 'Android.Widget.FrameLayout'.
03-27 16:01:50.372 I/MonoDroid(27996): at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in :0
03-27 16:01:50.372 I/MonoDroid(27996): at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in :0
03-27 16:01:50.372 I/MonoDroid(27996): at Android.Views.ViewGroup.RemoveView (Android.Views.View view) [0x00031] in <848bbd7c681a4975918c72f17d2f5144>:0
03-27 16:01:50.372 I/MonoDroid(27996): at Syncfusion.SfImageEditor.Android.SfImageEditor.b__274_0 () [0x0002f] in :0
03-27 16:01:50.372 I/MonoDroid(27996): at Java.Lang.Runnable.Run () [0x00000] in <848bbd7c681a4975918c72f17d2f5144>:0
03-27 16:01:50.372 I/MonoDroid(27996): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <848bbd7c681a4975918c72f17d2f5144>:0
03-27 16:01:50.372 I/MonoDroid(27996): at (wrapper dynamic-method) System.Object:42c1239f-f463-4675-9dcf-59b18e01d685 (intptr,intptr)
03-27 16:01:50.383 D/Mono (27996): Assembly Ref addref HockeySDK.AndroidBindings[0x7e91a79d00] -> System[0x7e8f6f2d00]: 30
03-27 16:01:50.401 W/art (27996): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

I am sorry I cannot send a proper project with a repro but I am hoping you may be able to find it from the stack trace.

Thanks
Jose

5 Replies

MV Mohana V Syncfusion Team March 29, 2018 06:03 PM UTC

Hi Jose,

We have created a separate incident for further follow up's about “Image editor ObjectDisposedException” under your Direct-trac login account.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents 

Regards,
Mohana V  



LW Leo Wetterek August 13, 2019 05:22 PM UTC

I also have problem with navigation away from  the sfimageeditor.

The editor is not removed when setting the content of the page to null. Wrapping it in a layout and setting it to null - does not remove the sfimageeditor. And I can't - just like you navigate away from the page containing the sfimageeditor. Tested on iOS.


RA Rachel A Syncfusion Team August 14, 2019 12:49 PM UTC

Hi Joes, 
 
We have prepared a simple sample with the provided details and checked the reported problems in 3 platforms. But we afraid that, we are not able to reproduce the reported issues in our side. Can you please check with the sample in the following location? If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to give better solution in this. 
 
 
We have tested in below configuration 
 
iOS : 
iPhoneSimulator: IPhone XS Max 12.1  
MAC OS: 10.14.2 
Xamarin.iOS Version : 12.2.1.12 
XCode Version :  10.1 
 
Android : 
Device: Moto E2 
API Version : 23 
 
Regards, 
Rachel. 



LW Leo Wetterek August 15, 2019 12:50 PM UTC

Initially I tried navigating - as well as setting content of the page to null - from an event handler hooked up to ImageSaved event. Then I believe I used a a layout wrapping sfimageeditor and a button and - trying the same thing.

But it could not have been inside a StackLayout - because the sfimageeditor will not appear inside that layout

For instance:

<ContentPage.Content>
        <StackLayout>
            <imageeditor:SfImageEditor x:Name="editor"
                                     Source="{Binding Image}"
                                     RotatableElements="Text">
            </imageeditor:SfImageEditor>
            <Button Text="Make page content null" Clicked="Handle_Clicked"/>
        </StackLayout>
    </ContentPage.Content>

Will not display the sfimageeditor.

So am I unsure I tried that. The sample you provided works fine. The navigation I tried was the following: await App.Current.MainPage.Navigation.PushAsync(new ContentPage()); in code behind.

In conclusion navigating or setting content of the page to null from ImageSaved event might have been the issue for me.

Thank you for the quick response.



VR Vignesh Ramesh Syncfusion Team August 20, 2019 07:54 PM UTC

Hi Leo, 

Thanks for the update. 

Query 1: the sfimageeditor will not appear inside that layout 
While placing controls inside the StackLayout, its height and width request does not calculate properly by default. So, only the SfImageEditor is not get appeared. You can overcome this problem by setting Height and Width Request for ImageEditor. 

Query 2: null from ImageSaved event might have been the issue for me 
We have modified the sample with the provided details and checked the reported problem. We got the below exception in iOS platform. But it seems like it is not thrown from SfImageEditor source.  
 
i)While setting content = null in ImageSavedEvent: 
 
 
ii)While navigating to new content page from ImageSavedEvent: 
 
 
Meanwhile, could you please confirm us whether you also facing the same exception? If you are facing different error, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to give better solution in this.  
 

Regards, 
Vignesh. 


Loader.
Up arrow icon