System.ObjectDisposedException: Cannot access a disposed object 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer' #10801
Comments
Related #8262 Workaround-#8262 (comment) Building a custom renderer for a ListView or its cells is one approach to reducing the effect of layout calculations on scrolling performance. |
Try to implement INotifyPropertyChanged (System.ComponentModel) for the class which contains the ListView.
|
Related #10159 |
Can you please attach a small project that demonstrates this issue? Thanks! |
I'm also facing the same issue crashing my app Stack Trace:
|
Downgrading XF to version 4.4.0.991864 solved the issue on our production app. Credits: #10159 (comment) |
@samhouts I can't publish the source code, it's a commercial application ... and it can only work with data. |
@samhouts unfortunately I can't publish the code due to contractual reasons |
Hello, just checking if there are any timelines on by when the fix would be available. We have a major release going out and is now on hold just because of this issue after we upgraded our Xamarin framework. At this point we can't go back to the old framework as well. Please help. |
These issues are very difficult to resolve without a reproduction. You may be able to work around it by enabling the legacy renderers. If you're able to post a reproduction project, we may be able to resolve the issue fully. Thank you! |
I understand, I am trying to reproduce on a test project. |
@samhouts, I tried enabling the legacy renderers as per the provided instructions however surprisingly the error still persists! I tried cleaning the solution, closing/opening VS but the error still persists. Please suggest. Any help in this regard would be immensely helpful! |
Will this fix be included in the next 4.8? Or just 5.0? |
Next SR of 4.8 |
The same exception on 4.8.0.1451: {InnerException: null StackTrace: at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <324349c9a2dd47568c91620d2bd3db5a>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <324349c9a2dd47568c91620d2bd3db5a>:0
at Android.Views.View.get_Context () [0x0000a] in <f69f42e19d884caca4279f1717610a26>:0
at Xamarin.Forms.Platform.Android.Platform.GetNativeSize (Xamarin.Forms.VisualElement view, System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:1341
at Xamarin.Forms.Forms+AndroidPlatformServices.GetNativeSize (Xamarin.Forms.VisualElement view, System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Forms.cs:921
at Xamarin.Forms.VisualElement.OnSizeRequest (Syst
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <324349c9a2dd47568c91620d2bd3db5a>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <324349c9a2dd47568c91620d2bd3db5a>:0
at Android.Views.View.get_Context () [0x0000a] in <f69f42e19d884caca4279f1717610a26>:0
at Xamarin.Forms.Platform.Android.Platform.GetNativeSize (Xamarin.Forms.VisualElement view, System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:1341
at Xamarin.Forms.Forms+AndroidPlatformServices.GetNativeSize (Xamarin.Forms.VisualElement view, System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Forms.cs:921
at Xamarin.Forms.VisualElement.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00025] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:811
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:796
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:738
at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x00236] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:198
at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:796
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:113
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:738
at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:796
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:113
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:738
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x0007b] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:133
at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29
at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:814
at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:362
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <f69f42e19d884caca4279f1717610a26>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <f69f42e19d884caca4279f1717610a26>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.36(intptr,intptr)
Cannot access a disposed object.
Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer'.
Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer
Java.Interop
System.ObjectDisposedException
|
It's not in that release, you will need to wait for Xamarin forms 4.8 Service Release 3 |
@joshuangfraedom You mean that this issue is fixed in Xamarin forms 4.8 Service Release 3 ? When it is planned to be published ? How long to wait ... :-))) |
I'm not sure sorry, it looks like the fix for this is currently in XF 5.0 Prerelease 1 if you wanted to give that a go. @samhouts are we able to get an update on another service release for 4.8? |
…t zero space for it (xamarin#12114) fixes xamarin#10801
…t zero space for it (xamarin#12114) fixes xamarin#10801
I tested a project with the same error, Xamarin 5.0.0.1539-pre2 and it still persists
Using this line Without flag line the ObjectName: |
@TsplayerT Can you post the full stack trace? |
Here it is:
The details of the error and other information are attached. report.txt |
This should be reopened. I can also reproduce it on 5.0.0.1558-pre3.
|
@mduchev I realize the exception name is the same but this type of exception is like a NullReferenceException. Each one is a different cause. The one you are having won't be related to this one. If you can create a new issue with a repro that would be helpful |
@mduchev Are you seeing your exception in 4.8? |
@mduchev I noticed your exception is coming from a custom renderer If you just use our renderer do you see the same exception? You might need to check if your FrameRenderer has been disposed and not call into this code
|
@PureWeen It may be another issue, can't say for sure. I'm seeing ObjectDisposedException and, like I said, occasionally, the exception is ObjectDisposedException for the FastRenderers.LabelRenderer (for the same flow!). |
@mduchev or does anyone know why version 5 of Xamarin will be released saying that this problem has been fixed but is still occurring? I could not understand. Even using this line Without line to flag, the exception has this ObjectName: |
@TsplayerT I think that the issue that we are both seeing (the FrameRenderer exception) is a separate issue. The main issue - the one with the LabelRenderer may be indeed fixed, but a similar bug is happening with the FrameRenderer. I also noticed the new exception only when I'm using something inside a Frame. Unfortunately, I cannot pinpoint the exact layout and steps which crash the app. If you can, please provide a sample project and open a new issue for the frame exception. |
@ZeProgFactory Thank you for the perfect workaround for people like me, who can't update to the latest Xamarin version, due to a lot of issues, which are still pending to be added to a specific sprint even... |
What was the workaround? |
Same issue with Xamarin.Forms version 5.0.0.2401. This should a top priority in deveopment. Below is the stack trace of the error. System.ObjectDisposedException: Cannot access a disposed object. |
@PureWeen the Nuget is not available anymore (link showing an empty page) - i think i cannot use some nuget for our project so easily anyway - but i'm very curious what that workaround was? Do you have the code to share? Was it some custom-renderers? |
This issue has been moved from a ticket on Developer Community.
After upgrading to the Xamarin Forms 4.6.0726, starting getting frequent intermittent crash on Android. Upon investigation, found that this is coming from Xamarin's LabelRenderer
05-17 07:27:06.656 E/mono ( 5133):
05-17 07:27:06.656 E/mono ( 5133): Unhandled Exception:
05-17 07:27:06.656 E/mono ( 5133): System.ObjectDisposedException: Cannot access a disposed object.
05-17 07:27:06.656 E/mono ( 5133): Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer'.
05-17 07:27:06.656 E/mono ( 5133): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.29(intptr,intptr)
05-17 07:27:06.656 E/mono ( 5133): at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.29(intptr,intptr)
05-17 07:27:06.656 E/mono-rt ( 5133): [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
05-17 07:27:06.656 E/mono-rt ( 5133): Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer'.
05-17 07:27:06.656 E/mono-rt ( 5133): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.29(intptr,intptr)
05-17 07:27:06.656 E/mono-rt ( 5133): at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.29(intptr,intptr)
05-17 07:27:06.698 D/ ( 5133): HostConnection::get() New Host Connection established 0xbd1b1240, tid 5133
Not sure where it is coming from. I have ListView as main view and wondering something is wrong with newer version of ListView causing leak and crash.
I don't have a custom label renderer so it has to be coming from Xamarin's platform renderer
Please suggest.
Original Comments
Visual Studio Feedback System on 5/17/2020, 11:54 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: