After Save -> close page crash

After saving the image I close the screen.
And after I close it crashes.

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.ObjectDisposedException: Cannot access a disposed object.
[MonoDroid] Object name: 'Android.Widget.FrameLayout'.
[MonoDroid]   at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <dcbf64ae8f9943dcab345b6fa6378854>:0 
[MonoDroid]   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <dcbf64ae8f9943dcab345b6fa6378854>:0 
[MonoDroid]   at Android.Views.ViewGroup.RemoveView (Android.Views.View view) [0x00031] in <303b75409d4e4a17bc65607d320bb98e>:0 
[MonoDroid]   at Syncfusion.SfImageEditor.Android.SfImageEditor.<RemoveSavingView>b__274_0 () [0x0002f] in <fbf711c79314464f85ca9cdec13222ab>:0 
[MonoDroid]   at Java.Lang.Runnable.Run () [0x00000] in <303b75409d4e4a17bc65607d320bb98e>:0 
[MonoDroid]   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <303b75409d4e4a17bc65607d320bb98e>:0 
[MonoDroid]   at (wrapper dynamic-method) System.Object.b8aa691f-fdc3-41c1-aefd-3e2ed86ee230(intptr,intptr)

7 Replies

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

Hi Rudá,

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  



RB Rys Bilinski April 3, 2018 11:58 AM UTC

Hi,

I am also getting this error when navigating away from a bage with the SFImage Control. Is there a fix for this?


MV Mohana V Syncfusion Team April 4, 2018 04:30 AM UTC

Hi Rys,

Sorry for the inconvenience caused.

We have validated the reported query "Cannot access a disposed object while navigating back" and this crash will occur only if you are trying to access the disposed object. So, could you please ensure whether you are trying to access disposed object of image editor anywhere in your project.

In order to avoid the occurence of crash, we have handled the exception in source level also we have included the fix for this issue in our refresh build version (v16.1.0.26). This fix will be available from nuget version(v16.1.0.26) onwards, so can you refer latest nuget package to overcome the reported issue.

Refer to the below link to know further details about how to manage nuget package

https://help.syncfusion.com/xamarin/introduction/download-and-installation/mac

Please get back us, if you are still facing the reported issue and share us the exact replication procedure so that we would assist you further from our side.

Regards,
Mohana V  



AC Adrian Crutchfield June 20, 2018 05:58 PM UTC

I'm still seeing the same crash on iOS.

SfImageEditor 16.1.0.37

Cannot access a disposed object.
Object name: 'SfImageEditor'.

  at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/Foundation/NSObject2.cs:435 
  at UIKit.UIView.get_Subviews () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIView.g.cs:4124 
  at Syncfusion.SfImageEditor.iOS.SfImageEditor.Reset () [0x00094] in <be092e4c47f34fb2a36639b13a37ebc8>:0 
  at Syncfusion.SfImageEditor.iOS.SfImageEditor.SetImage (UIKit.UIImage im) [0x00007] in <be092e4c47f34fb2a36639b13a37ebc8>:0 
  at Syncfusion.SfImageEditor.iOS.SfImageEditor.set_Image (UIKit.UIImage value) [0x00007] in <be092e4c47f34fb2a36639b13a37ebc8>:0 
  at Syncfusion.SfImageEditor.XForms.iOS.ImageEditorMapping+<setBitmap>d__8.MoveNext () [0x000a5] in <be092e4c47f34fb2a36639b13a37ebc8>:0 
--- End of stack trace from previous location where exception was thrown ---


JK Jeya Kasipandi Syncfusion Team June 21, 2018 10:23 AM UTC

Hi Adrian Crutchfield,

Sorry for the inconvenience caused.

We have analyzed your query and we are unable to reproduce the reported issue “Cannot access a disposed object”, but given your stack trace we have made some tests and we were able to reproduce an exception closer to your stack trace and it is the “UIThreadAccess exception” while disposing the image editor in saved event.

Please refer below screen shot for stack trace details.

Screen shot:
 
 
Having said that both these exception is because of the UI thread, which is running while saving and at the same time the Image Editor is disposed. This can be handled in sample level by invoking the main thread to dispose or remove editor in your application. Since we are not aware of the exact scenario where you are removing the editor in your application we have prepared a simple sample to overcome this issue by removing the editor on invoking the main thread, you can download the sample from the below link.


Code snippet:

editor.ImageSaved += (object sender, ImageSavedEventArgs args) => {
                Device.BeginInvokeOnMainThread(async () =>
                {
                     mainGrid.Children.Remove(editor);
 
               });
            };
 
Note: We have already fixed “Cannot access a disposed object” exception in for android in the assembly version 16.1.0.37. We have not come across “Cannot access a disposed object” in iOS, so if you could provide your exact scenario it would be helpful for us to fix and provide you a better solution.

Let us know if the above sample solution helps.

Regards,
Jeya k



CC CT CHANG replied to Jeya Kasipandi September 9, 2018 01:02 PM UTC

Hi Adrian Crutchfield,

Sorry for the inconvenience caused.

We have analyzed your query and we are unable to reproduce the reported issue “Cannot access a disposed object”, but given your stack trace we have made some tests and we were able to reproduce an exception closer to your stack trace and it is the “UIThreadAccess exception” while disposing the image editor in saved event.

Please refer below screen shot for stack trace details.

Screen shot:
 
 
Having said that both these exception is because of the UI thread, which is running while saving and at the same time the Image Editor is disposed. This can be handled in sample level by invoking the main thread to dispose or remove editor in your application. Since we are not aware of the exact scenario where you are removing the editor in your application we have prepared a simple sample to overcome this issue by removing the editor on invoking the main thread, you can download the sample from the below link.


Code snippet:

editor.ImageSaved += (object sender, ImageSavedEventArgs args) => {
                Device.BeginInvokeOnMainThread(async () =>
                {
                     mainGrid.Children.Remove(editor);
 
               });
            };
 
Note: We have already fixed “Cannot access a disposed object” exception in for android in the assembly version 16.1.0.37. We have not come across “Cannot access a disposed object” in iOS, so if you could provide your exact scenario it would be helpful for us to fix and provide you a better solution.

Let us know if the above sample solution helps.

Regards,
Jeya k


Thank Jeya, 

This does solved the problem.

CT


MP Michael Prabhu M Syncfusion Team September 10, 2018 07:14 AM UTC

Hi Chang Chiew Thou, 
 
Thanks for the update, glad your issue is resolved. Feel free to contact us any time if you need any other assistance from us. We are happy to help you. 
 
Thanks, 
Michael 



Loader.
Up arrow icon