Open HoGo72 opened 1 month ago
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!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
@HoGo72 if you don't use a compatibility StackLayout does the same thing happen?
@HoGo72 if you don't use a compatibility StackLayout does the same thing happen?
No, Microsoft.Maui.Controls.StackLayout works. But I migrate from Xamarin with heavy use of Forms.StackLayout./...AndExpand. So I cannot use this.
@HoGo72 you can maybe workaround this by calling disconnecthandler on the child views
(view.Handler.DisconnectHandler)
before adding it to the new view.
@HoGo72 you can maybe workaround this by calling disconnecthandler on the child views
(view.Handler.DisconnectHandler)
before adding it to the new view. Thx, yes, workaround works. But you'll need also to handle sub-children, even if view.Handler is null.
Description
On Android -14-Simulator I get "System.ObjectDisposedException" after re-adding a Microsoft.Maui-Compatibility.StackLayout to another Stacklayout. iOS-Simulator: OK Tizen: not testet Mac: not testet Windows: not tested because of "The handler's Maui-Context cannot be null."-Exception during UseMauiCompatibility
Steps to Reproduce
Create Sample-Maui-Project, replace MainPage with this: using CStackLayout=Microsoft.Maui.Controls.Compatibility.StackLayout;
namespace MauiApp1 {
}
Change to Android-Simulator, start program, press "Update"-Button -> Exception is thrown
Btw: 1) change to "using CStackLayout = Microsoft.Maui.Controls.StackLayout;" repairs the problem. But I migrate from Xamarin, so I have to use Compatibility. 2) In my real- life project I get in similar case Java.Lang.IllegalStateException: 'The specified child already has a parent. You must call removeView() on the child's parent first.' I hope that's the same problem...
Link to public reproduction project repository
https://github.com/HoGo72/MauiCompatibilityStacklayoutCrash.git
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 14
Did you find any workaround?
No response
Relevant log output
No response