Giter Club home page Giter Club logo

Comments (4)

drasticactions avatar drasticactions commented on June 29, 2024

Your exception is

System.InvalidOperationException: MauiContext should have been set on parent.
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view)
   at Microsoft.Maui.Handlers.LayoutHandler.Remove(IView child)
   at Microsoft.Maui.Handlers.LayoutHandler.MapRemove(ILayoutHandler handler, ILayout layout, Object arg)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.ILayoutHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)
   at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
   at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
   at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.RemoveAt(Int32 index)
   at Microsoft.Maui.Controls.Layout.Remove(IView child)
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.RemoveCropView()
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.Syncfusion.Maui.ImageEditor.IToolbarActions.CancelEdit()
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.HandleItemTapped(SfToolbarItem tappedItem, SfToolbarItem previousItem)
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.OnToolbarItemTapped(Object sender, ToolbarTappedEventArgs e)
   at Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)
   at Syncfusion.Maui.Core.Internals.SfToolbarLayout.Syncfusion.Maui.Core.Internals.ITapGestureListener.OnTap(TapEventArgs e)
   at Syncfusion.Maui.Core.Internals.GestureDetector.OnTapped(Point touchPoint, Int32 tapCount)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.OnTap(GestureDetector gestureDetector)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.<>c__DisplayClass1_0.<.ctor>b__0()
   at UIKit.UIGestureRecognizer.ParameterlessDispatch.Activated() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGestureRecognizer.cs:line 107
--- End of stack trace from previous location ---
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at MauiMopupsSample.Program.Main(String[] args) in /Users/drasticactions/Developer/Work/ImageEditor-Mopup-Issue/MauiMopupsSample/MauiMopupsSample/MauiMopupsSample/Platforms/iOS/Program.cs:line 13

The important parts are

System.InvalidOperationException: MauiContext should have been set on parent.

and

Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)

IMO, this seems like a Syncfusion issue. I would direct this to them first, as I think that's the issue's root. If it is MAUI, they can circle back.

@PureWeen @mattleibow what do you all think?

from maui.

ESO-ST avatar ESO-ST commented on June 29, 2024

I get the same exception when using Carousel in MAUI, it started in version 8.0.60, I tested it in v8.0.40 and it works fine there.
I even tried it in the latest nightly build, 8.0.70-ci.net8.24139.2 and it happens there as well.
For me it takes place when I move to the 4th page of the carousel, the first 3 pages work fine, as soon as I try to move to the 4th page I get the crash.

2024-06-20 20:59:32.172790+0100 MyProject[4427:14609335] Unhandled managed exception: MauiContext should have been set on parent. (System.InvalidOperationException)
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view)
   at Microsoft.Maui.Handlers.LayoutHandler.Remove(IView child)
   at Microsoft.Maui.Handlers.LayoutHandler.MapRemove(ILayoutHandler handler, ILayout layout, Object arg)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.ILayoutHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)
   at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
   at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
   at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.FlexLayout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.RemoveAt(Int32 index)
   at Microsoft.Maui.Controls.BindableLayout.RemoveAt(IBindableLayout layout, Int32 index)
   at Microsoft.Maui.Controls.BindableLayoutController.ClearChildren(IBindableLayout layout)
   at Microsoft.Maui.Controls.BindableLayoutController.CreateChildren()
   at Microsoft.Maui.Controls.BindableLayoutController.SetItemsSource(IEnumerable itemsSource)
   at Microsoft.Maui.Controls.BindableLayoutController.set_ItemsSource(IEnumerable value)
   at Microsoft.Maui.Controls.BindableLayout.<>c.<.cctor>b__24_0(BindableObject b, Object o, Object n)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindingExpression.Apply(Object sourceObject, BindableObject target, BindableProperty property, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Binding.Apply(Object context, BindableObject bindObj, BindableProperty targetProperty, Boolean fromBindingContextChanged, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.ApplyBindings(Boolean skipBindingContext, Boolean fromBindingContextChanged)
   at Microsoft.Maui.Controls.BindableObject.BindingContextPropertyChanged(BindableObject bindable, Object oldvalue, Object newvalue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
   at Microsoft.Maui.Controls.BindableObject.set_BindingContext(Object value)
   at Microsoft.Maui.Controls.Handlers.Items.TemplatedCell.Unbind()
   at Microsoft.Maui.Controls.Handlers.Items.TemplatedCell.PrepareForReuse()
   at UIKit.UICollectionView.DequeueReusableCell(NSString reuseIdentifier, NSIndexPath indexPath) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UICollectionView.g.cs:line 234
   at UIKit.UICollectionView.DequeueReusableCell(String reuseIdentifier, NSIndexPath indexPath) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UICollectionView.cs:line 23
   at Microsoft.Maui.Controls.Handlers.Items.ItemsViewController`1[[Microsoft.Maui.Controls.CarouselView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetCell(UICollectionView collectionView, NSIndexPath indexPath)
   at Microsoft.Maui.Controls.Handlers.Items.CarouselViewController.GetCell(UICollectionView collectionView, NSIndexPath indexPath)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94

from maui.

ninachen03 avatar ninachen03 commented on June 29, 2024

I can repro this issue on Visual Studio 17.11.0 Preview 2.1 ( 8.0.40)
image

from maui.

PureWeen avatar PureWeen commented on June 29, 2024

Your exception is

System.InvalidOperationException: MauiContext should have been set on parent.
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view)
   at Microsoft.Maui.Handlers.LayoutHandler.Remove(IView child)
   at Microsoft.Maui.Handlers.LayoutHandler.MapRemove(ILayoutHandler handler, ILayout layout, Object arg)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.ILayoutHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)
   at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
   at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
   at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.RemoveAt(Int32 index)
   at Microsoft.Maui.Controls.Layout.Remove(IView child)
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.RemoveCropView()
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.Syncfusion.Maui.ImageEditor.IToolbarActions.CancelEdit()
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.HandleItemTapped(SfToolbarItem tappedItem, SfToolbarItem previousItem)
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.OnToolbarItemTapped(Object sender, ToolbarTappedEventArgs e)
   at Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)
   at Syncfusion.Maui.Core.Internals.SfToolbarLayout.Syncfusion.Maui.Core.Internals.ITapGestureListener.OnTap(TapEventArgs e)
   at Syncfusion.Maui.Core.Internals.GestureDetector.OnTapped(Point touchPoint, Int32 tapCount)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.OnTap(GestureDetector gestureDetector)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.<>c__DisplayClass1_0.<.ctor>b__0()
   at UIKit.UIGestureRecognizer.ParameterlessDispatch.Activated() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGestureRecognizer.cs:line 107
--- End of stack trace from previous location ---
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at MauiMopupsSample.Program.Main(String[] args) in /Users/drasticactions/Developer/Work/ImageEditor-Mopup-Issue/MauiMopupsSample/MauiMopupsSample/MauiMopupsSample/Platforms/iOS/Program.cs:line 13

The important parts are

System.InvalidOperationException: MauiContext should have been set on parent.

and

Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)

IMO, this seems like a Syncfusion issue. I would direct this to them first, as I think that's the issue's root. If it is MAUI, they can circle back.

@PureWeen @mattleibow what do you all think?

Your exception is

System.InvalidOperationException: MauiContext should have been set on parent.
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view)
   at Microsoft.Maui.Handlers.LayoutHandler.Remove(IView child)
   at Microsoft.Maui.Handlers.LayoutHandler.MapRemove(ILayoutHandler handler, ILayout layout, Object arg)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.ILayoutHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)
   at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
   at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
   at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.OnRemove(Int32 index, IView view)
   at Microsoft.Maui.Controls.Layout.RemoveAt(Int32 index)
   at Microsoft.Maui.Controls.Layout.Remove(IView child)
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.RemoveCropView()
   at Syncfusion.Maui.ImageEditor.ImageEditLayout.Syncfusion.Maui.ImageEditor.IToolbarActions.CancelEdit()
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.HandleItemTapped(SfToolbarItem tappedItem, SfToolbarItem previousItem)
   at Syncfusion.Maui.ImageEditor.ToolbarLayout.OnToolbarItemTapped(Object sender, ToolbarTappedEventArgs e)
   at Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)
   at Syncfusion.Maui.Core.Internals.SfToolbarLayout.Syncfusion.Maui.Core.Internals.ITapGestureListener.OnTap(TapEventArgs e)
   at Syncfusion.Maui.Core.Internals.GestureDetector.OnTapped(Point touchPoint, Int32 tapCount)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.OnTap(GestureDetector gestureDetector)
   at Syncfusion.Maui.Core.Internals.GestureDetector.UITapGestureExt.<>c__DisplayClass1_0.<.ctor>b__0()
   at UIKit.UIGestureRecognizer.ParameterlessDispatch.Activated() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGestureRecognizer.cs:line 107
--- End of stack trace from previous location ---
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at MauiMopupsSample.Program.Main(String[] args) in /Users/drasticactions/Developer/Work/ImageEditor-Mopup-Issue/MauiMopupsSample/MauiMopupsSample/MauiMopupsSample/Platforms/iOS/Program.cs:line 13

The important parts are

System.InvalidOperationException: MauiContext should have been set on parent.

and

Syncfusion.Maui.Core.Internals.SfToolbar.Syncfusion.Maui.Core.Internals.IToolbar.InvokeTappedEvent(SfToolbarItem toolbarItem, SfToolbarItem previousToolbarItem)

IMO, this seems like a Syncfusion issue. I would direct this to them first, as I think that's the issue's root. If it is MAUI, they can circle back.

@PureWeen @mattleibow what do you all think?

Yea, the error here is that a view is being removed from a layout that is no longer connected.

We do get the index as part of the remove command

image

so, in theory we could use the index vs the platform view to remove the view, but I do worry this just moves the exception down the pipeline. Because there shouldn't really be a path like this triggering.

from maui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.