maui
maui copied to clipboard
Crash App when change ControlTemplate and click item in Android App MAUI
Description
I have a ControlTemplate in a CustomView, which will receive two StackLayout StaffLayout and AdminLayout.
When I click Staff Tab, it will assign ControlTemplate with StaffLayout and I click item in layout, it will normal. And then change to click Admin Tab, it will assign ControlTemplate with AdminLayout. Error occur when I click again to Staff Tab , and then click to item in layout, the app is crashed and error comeout in debug section.
I place debug breakpoint in when assign ControlTemplate and see that ControlTemplate updated to another one, and Item in it changes when tab changes. But when I click in item, the error occur. And this error only happen in Android platform, this work normal on iOS platform.
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.6 SR1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11 and up
Did you find any workaround?
No response
Relevant log output
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Microsoft.Maui.Platform.MauiTextView'.
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
- [Android] App crashes when changing tabs in Shell TabBar (#17568), similarity score: 0.77
- WinUI: TabbedPage pages provided by a DataTemplate crash when swapping to a different tab. (#14572), similarity score: 0.76
Closed similar issues:
- CONTROL TEMPLATES CRASHING (#12490), similarity score: 0.77
- Android App crash if the itemtemplate of CollectionView have MultiBinding (#17711), similarity score: 0.77
- Changing
<DataTemplate/>contents can give a runtime exception (#11203), similarity score: 0.76
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Hi @ChanNL-IT. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.