Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on ios when open new screen or navigate back to it #24032

Closed
DmitryNikiforovCoherent opened this issue Aug 6, 2024 · 58 comments · Fixed by #24637
Closed

Crash on ios when open new screen or navigate back to it #24032

DmitryNikiforovCoherent opened this issue Aug 6, 2024 · 58 comments · Fixed by #24637
Assignees
Labels
area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events fixed-in-8.0.82 fixed-in-8.0.90 fixed-in-9.0.0-rc.1.24453.9 i/regression This issue described a confirmed regression on a currently supported version p/0 Work that we can't release without platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Milestone

Comments

@DmitryNikiforovCoherent
Copy link

Description

It seems, there were similar issues previously
#23139,
but now issue appeared after upgrade to maui to 8.0.70 and removing .UseMauiCompatibility()
Sometimes view try to created with NativeHandle argument in constructor

This crash can appeared with Microsoft.Maui.Platform.ContentView|LayoutView and some custom views(so, adding constructor with ObjCRuntime.NativeHandle resolve issue for custom views, but no any options to resolve crashes with ContentView, LayoutView)

Steps to Reproduce

Sometimes just randomly appeared when navigate to new screen or navigate back to existing

Link to public reproduction project repository

No response

Version with bug

8.0.70 SR7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.40 SR5

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

For custom views we can just add constructor with ObjCRuntime.NativeHandle handle, but no any ways to fix ios ContentView/LayoutView

Relevant log output

Unhandled managed exception: Failed to marshal the Objective-C object 0x14177b170 (type: Microsoft_Maui_Platform_ContentView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.ContentView' does not have a constructor that takes one NativeHandle argument). (ObjCRuntime.RuntimeException)
   at ObjCRuntime.Runtime.MissingCtor(IntPtr , IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.ConstructNSObject[UIView](IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle , Boolean )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr )
   at UIKit.UIView.get_Superview()
   at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()
@DmitryNikiforovCoherent DmitryNikiforovCoherent added the t/bug Something isn't working label Aug 6, 2024
Copy link
Contributor

github-actions bot commented Aug 6, 2024

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!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@jfversluis jfversluis added the s/needs-repro Attach a solution or code which reproduces the issue label Aug 6, 2024
@DmitryNikiforovCoherent
Copy link
Author

@jfversluis Could you help, what can be the reason of creating ios view with additional parameter in ctor? As I see from logs, sometimes this happens just during simple navigatio

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Aug 6, 2024
@jfversluis
Copy link
Member

Without a reproduction project of sorts its very hard to say something useful about it unfortunately

@jfversluis jfversluis added s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Aug 6, 2024
@DmitryNikiforovCoherent
Copy link
Author

DmitryNikiforovCoherent commented Aug 6, 2024

As I investigate, one of case(but not only): this happened, when we have CachedImage from FFImageLoading library on the ContentPage

  1. Screen started, start load data
  2. User tap on button, that hide part of page content, including CachedImage(custom implementation of tab behavior)
  3. Data loaded, ImageSource set for hidden CachedImage, and CachedImageHandler.ImageLoadingSizeChanged called
  4. Maui tries to redraw all parent and for some reason try to recreate LayoutView
ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x11ef7ad40 (type: Microsoft_Maui_Platform_LayoutView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.LayoutView' does not have a constructor that takes one NativeHandle argument).
   at ObjCRuntime.Runtime.MissingCtor(IntPtr , IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.ConstructNSObject[UIView](IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle , Boolean )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle )
   at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr )
   at UIKit.UIView.get_Superview()
   at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()
   at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()
   at Microsoft.Maui.Handlers.ViewHandler.MapInvalidateMeasure(IViewHandler handler, IView view, Object args)
   at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.IView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.IViewHandler, 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.Handlers.ElementHandler.Invoke(String command, Object args)
   at Microsoft.Maui.Controls.VisualElement.InvalidateMeasureOverride()
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.InvalidateMeasure()
   at Microsoft.Maui.Controls.VisualElement.InvalidateMeasureInternal(InvalidationTrigger trigger)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.Controls.IVisualElementController.InvalidateMeasure(InvalidationTrigger trigger)
   at FFImageLoading.Maui.Platform.CachedImageHandler.<>c__DisplayClass15_0.<ImageLoadingSizeChanged>b__0()
   at Microsoft.Maui.Dispatching.DispatcherExtensions.<>c__DisplayClass1_0.<DispatchAsync>b__0()
   at Microsoft.Maui.Dispatching.DispatcherExtensions.<>c__DisplayClass0_0`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<DispatchAsync>b__0()
--- End of stack trace from previous location ---
   at FFImageLoading.Maui.Platform.CachedImageHandler.ImageLoadingSizeChanged(CachedImage element, Boolean isLoading)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Aug 6, 2024
@DmitryNikiforovCoherent
Copy link
Author

So, it seems, that when in MauiView.SetNeedsLayout try to get Superview, crash appeared if Superview is not visible

@DmitryNikiforovCoherent
Copy link
Author

DmitryNikiforovCoherent commented Aug 8, 2024

In this project reproduced not very often, need try to open several times and switch between tabs.
cc @jfversluis
MauiApp1.zip

@reid-kirkpatrick
Copy link

@DmitryNikiforovCoherent @jfversluis @Redth we are also seeing this with FFImageLoading as we convert our app. It's one of the last major issues we're having. Any ideas?

@jfversluis
Copy link
Member

I see the repro also uses FFImageLoading. If we take FFImageLoading out of the equation, does it work then?

Just to establish if this is something in MAUI or FFImageLoading?

@DmitryNikiforovCoherent
Copy link
Author

I'm not sure, according to the analytics, sometimes we also faced with this issue with next logs
Unhandled managed exception: Failed to marshal the Objective-C object 0x14177b170 (type: Microsoft_Maui_Platform_ContentView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.ContentView' does not have a constructor that takes one NativeHandle argument). (ObjCRuntime.RuntimeException) at ObjCRuntime.Runtime.MissingCtor(IntPtr , IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle ) at ObjCRuntime.Runtime.ConstructNSObject[UIView](IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle ) at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle , Boolean ) at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle ) at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr ) at UIKit.UIView.get_Superview() at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()

Without FFImageLoading.Maui.Platform.CachedImageHandler.ImageLoadingSizeChanged in stacktrace. But with FFImageLoading it's the simplest way to reproduce, because it has standard behavior to change control size after page loaded. As I mentioned above, it seems, sometimes, if control hidden, and child try to change size, get_Superview throw an exception
Will try to reproduce this with simple control like Label tomorrow

@DmitryNikiforovCoherent
Copy link
Author

@DmitryNikiforovCoherent @jfversluis @Redth we are also seeing this with FFImageLoading as we convert our app. It's one of the last major issues we're having. Any ideas?

If you need to fix fast, just downgrade maui to 8.0.40. For me this helps

@samhouts samhouts added platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending labels Aug 9, 2024
@PureWeen PureWeen added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Aug 9, 2024
@PureWeen PureWeen added this to the .NET 8 SR9 milestone Aug 9, 2024
@PureWeen PureWeen added i/regression This issue described a confirmed regression on a currently supported version and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Aug 9, 2024
@mackayn
Copy link

mackayn commented Aug 12, 2024

@jfversluis @PureWeen @samhouts Seeing this in production in our iOS app making it incredibly unstable for users, as mentioned above, this happens constantly in regular navigation and no FFImageLoading library in our app. This is a critical issue for us.

MAUI 8.0.80
iOS 16.5 to 17.6

SIGABRT: Failed to marshal the Objective-C object 0x153507310 (type: Microsoft_Maui_Platform_LayoutView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.LayoutView' does not have a constructor that takes one NativeHandle argument).

ObjCRuntime.Runtime.MissingCtor(IntPtr , IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
ObjCRuntime.Runtime.ConstructNSObject[UIView](IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr , IntPtr , RuntimeMethodHandle , Boolean )
UIKit.UIView.get_Superview()
Microsoft.Maui.Platform.LayoutView.WillRemoveSubview(UIView uiview)
ObjCRuntime.Runtime.RethrowManagedException(IntPtr )
UIKit.UIView.AddSubview(UIView )
Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler)
Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page)
Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view)
Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer.CreateViewControllerForPage(Page page)
Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer.OnPushAsync(Page page, Boolean animated)
Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer.<ViewDidLoad>b__53_0(Page p)
System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
Foundation.NSAsyncSynchronizationContextDispatcher.Apply()
ObjCRuntime.Runtime.ThrowException(IntPtr )
UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
UIKit.UIApplication.Main(String[] , Type , Type )
X.Mobile.Primary.Program.Main(String[] args)

@samhouts samhouts added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Aug 12, 2024
@mackayn
Copy link

mackayn commented Aug 12, 2024

@DmitryNikiforovCoherent @jfversluis @Redth we are also seeing this with FFImageLoading as we convert our app. It's one of the last major issues we're having. Any ideas?

If you need to fix fast, just downgrade maui to 8.0.40. For me this helps

Wish we could, production software relies on higher dependencies such as Prism which relies on 8.0.60. There has to be a stable version on .NET8 MAUI before we entertain .NET9, this is costing companies money now.

@PureWeen
Copy link
Member

PureWeen commented Aug 13, 2024

Is there anyone that's hitting this issue that's using Shell?

I have a theory, but it's something that'll only manifest if you're not using shell

@mackayn
Copy link

mackayn commented Aug 13, 2024

Is there anyone that's hitting this issue that's using Shell?

I have a theory, but it's something that'll only manifest if you're not using shell

100% not using shell.

@DmitryNikiforovCoherent
Copy link
Author

Is there anyone that's hitting this issue that's using Shell?

I have a theory, but it's something that'll only manifest if you're not using shell

The same, we are not using shell

@PureWeen
Copy link
Member

PureWeen commented Aug 27, 2024

SR9 should be out next week
If we were to try and roll a new SR8 it would probably end up being released about the same time as SR9 once it was tested/validated

Speaking of, if anyone can test the nugets from #24477 that would be helpful

@samhouts samhouts added the area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events label Aug 28, 2024
@mackayn
Copy link

mackayn commented Aug 28, 2024

SR9 should be out next week If we were to try and roll a new SR8 it would probably end up being released about the same time as SR9 once it was tested/validated

Speaking of, if anyone can test the nugets from #24477 that would be helpful

If you could provide a link I can test, we're having to go with 8.0.81-ci.net8.24413.37 at present as we can't wait any longer and it's more stable than 8.0.80, if you provide a link I can test before we put out a very hot fix.

@DmitryNikiforovCoherent
Copy link
Author

SR9 should be out next week If we were to try and roll a new SR8 it would probably end up being released about the same time as SR9 once it was tested/validated
Speaking of, if anyone can test the nugets from #24477 that would be helpful

If you could provide a link I can test, we're having to go with 8.0.81-ci.net8.24413.37 at present as we can't wait any longer and it's more stable than 8.0.80, if you provide a link I can test before we put out a very hot fix.

You can check current 8.0.81-ci from link https://dev.azure.com/xamarin/public/_build/results?buildId=121542&view=results (As @PureWeen provided above)

  1. Download nuget-macos folder, add to project folder
  2. Update Directory.Build.props with path to this folder $(MSBuildThisFileDirectory)/{folder}/nuget-macos
  3. Update version for maui packages to 8.0.81-ci.net8.24413.37
    For me smoke test was successful, but to be sure will wait for stable release(for now have downgraded to version 8.0.40, works well)

@mackayn
Copy link

mackayn commented Aug 28, 2024

SR9 should be out next week If we were to try and roll a new SR8 it would probably end up being released about the same time as SR9 once it was tested/validated
Speaking of, if anyone can test the nugets from #24477 that would be helpful

If you could provide a link I can test, we're having to go with 8.0.81-ci.net8.24413.37 at present as we can't wait any longer and it's more stable than 8.0.80, if you provide a link I can test before we put out a very hot fix.

You can check current 8.0.81-ci from link https://dev.azure.com/xamarin/public/_build/results?buildId=121542&view=results (As @PureWeen provided above)

  1. Download nuget-macos folder, add to project folder
  2. Update Directory.Build.props with path to this folder $(MSBuildThisFileDirectory)/{folder}/nuget-macos
  3. Update version for maui packages to 8.0.81-ci.net8.24413.37
    For me smoke test was successful, but to be sure will wait for stable release(for now have downgraded to version 8.0.40, works well)

Thanks, I am already using those libs with no issue, I was asking if I could get the nugets for #24477 which is a different issue (although related)

@PureWeen
Copy link
Member

PureWeen commented Aug 29, 2024

The latest nightlies should have the new version of the fix from #24477

https://github.com/dotnet/maui/wiki/Nightly-Builds

Let me know if that works

If not, I have an idea about how to add that code back in.

But if I don't have to :-) that'd be nice

Going to reopen this issue until I get some validation from y'all so we don't miss it

@PureWeen PureWeen reopened this Aug 29, 2024
@PureWeen PureWeen added p/0 Work that we can't release without and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Aug 29, 2024
@PureWeen PureWeen self-assigned this Aug 29, 2024
@pboisso
Copy link

pboisso commented Aug 29, 2024

Still crashing here with build 82.

@mackayn
Copy link

mackayn commented Aug 29, 2024

@PureWeen We couldn't wait so have a beta build release already out in testflight using 8.0.81-ci.net8.24413.37 with no navigation issues in release mode, client is testing atm. Once we have that out I'll re-test with the nightly builds

@PureWeen
Copy link
Member

Still crashing here with build 82.

yea, we rolled the change back for 82 because of a regression it caused

There's a different fix now on our main branch that you can test with nightlies
We'll release this in the next couple of weeks officially

@PureWeen
Copy link
Member

@PureWeen We couldn't wait so have a beta build release already out in testflight using 8.0.81-ci.net8.24413.37 with no navigation issues in release mode, client is testing atm. Once we have that out I'll re-test with the nightly builds

Here's what regressed

#24434

Not sure if this will apply to any of your scenarios but might help you know what to focus your testing on.

@mackayn
Copy link

mackayn commented Sep 3, 2024

@PureWeen

Just FYI, our iOS app went out into store release with 8.0.81-ci.net8.24413.37, not seeing this crash at all anymore so the fix is good, didn't appear in beta testing either. This app has over 100 pages and a lot of navigation interaction per session.

@PureWeen
Copy link
Member

PureWeen commented Sep 3, 2024

@reid-kirkpatrick @DmitryNikiforovCoherent @pboisso @sumowesley @thisisthekap @mackayn

If you have a chance to test the latest nightly can you see if it works there as well?

https://github.com/dotnet/maui/wiki/Nightly-Builds

Want to make sure this gets fixed for you all in SR9

@reid-kirkpatrick
Copy link

@PureWeen as far as I can tell after updating this is still working well. Thank you!

@sumowesley
Copy link

Hi @PureWeen,

I've tried 8.0.82 native, and I had a crash in three navigations. I then installed 8.0.90-ci.net8.24454.1 from the nightly build.

This crashed after a few iterations (5,3,6) as I switched between two screens. i then went back to the version using 8.0.40. While this has leak warnings from the navigation manager (not present in on the nightly build), I got to 16 page swaps before stopping.

Here is the first crash log:

Exception has occurred: ObjCRuntime.RuntimeException

- Failed to marshal the Objective-C object 0x139c39f60 (type: Microsoft_Maui_Platform_ContentView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.ContentView' does not have a constructor that takes one NativeHandle argument).

at ObjCRuntime.Runtime.MissingCtor(IntPtr ptr, IntPtr klass, Type type, MissingCtorResolution resolution, IntPtr sel, RuntimeMethodHandle method_handle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1412 at ObjCRuntime.Runtime.ConstructNSObject[UIView](IntPtr ptr, Type type, MissingCtorResolution missingCtorResolution, IntPtr sel, RuntimeMethodHandle method_handle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1543 at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr ptr, IntPtr sel, RuntimeMethodHandle method_handle, Boolean evenInFinalizerQueue) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1898 at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr ptr, IntPtr sel, RuntimeMethodHandle method_handle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1860 at ObjCRuntime.Runtime.GetNSObject[UIView](IntPtr ptr) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1855 at UIKit.UIView.get_Superview() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UIView.g.cs:4881 at at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()  at at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()  at at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()  at at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()  at at Microsoft.Maui.Platform.MauiView.SetNeedsLayout()  at at Microsoft.Maui.Platform.ViewExtensions.InvalidateMeasure(UIView platformView, IView view)  at at Microsoft.Maui.Handlers.ViewHandler.MapInvalidateMeasure(IViewHandler handler, IView view, Object args)  at at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0[[Microsoft.Maui.IView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.IViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v, Object o)  at at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)  at at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)  at at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)  at at Microsoft.Maui.Controls.VisualElement.InvalidateMeasureOverride()  at at Microsoft.Maui.Controls.Layout.InvalidateMeasureOverride()  at at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.InvalidateMeasure()  at at Microsoft.Maui.Controls.Layout.Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)  at at Microsoft.Maui.Controls.PaddingElement.OnPaddingPropertyChanged(BindableObject bindable, Object oldValue, Object newValue)  at at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)  at at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)  at at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity)  at at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget)  at at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0()  at at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)  at at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.PropertyChanged(Object sender, PropertyChangedEventArgs args)  at at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)  at at Microsoft.Maui.Controls.BindableObject.OnPropertyChanged(String propertyName)  at at The49.Maui.Insets.Insets.OnPropertyChanged(String propertyName)  at at The49.Maui.Insets.Insets.SetEnabled(Boolean enabled)  at at The49.Maui.Insets.Insets.UpdateEdgeToEdge(Page page)  at at The49.Maui.Insets.Insets.SetupPage(Page page)  at at The49.Maui.Insets.Insets.PagePropertyChanged(Object sender, PropertyChangedEventArgs e)  at at Microsoft.Maui.Controls.BindableObject.OnPropertyChanged(String propertyName)  at at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)  at at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)  at at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)  at at Microsoft.Maui.Controls.BindableObject.SetValue(BindablePropertyKey propertyKey, Object value)  at at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.Controls.IWindowController.set_Window(Window value)  at at Microsoft.Maui.Controls.Internals.PropertyPropagationExtensions.PropagateWindow(Element target, Element source)  at at Microsoft.Maui.Controls.Internals.PropertyPropagationExtensions.SetWindowFromParent(Element child)  at at Microsoft.Maui.Controls.Internals.PropertyPropagationExtensions.PropagatePropertyChanged(String propertyName, Element element, IEnumerable children)  at at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.Controls.IPropertyPropagationController.PropagatePropertyChanged(String propertyName)  at at Microsoft.Maui.Controls.Element.OnParentSet()  at at Microsoft.Maui.Controls.NavigableElement.OnParentSet()  at at Microsoft.Maui.Controls.Page.OnParentSet()  at at Microsoft.Maui.Controls.Element.SetParent(Element value)  at at Microsoft.Maui.Controls.Element.OnChildAdded(Element child)  at at Microsoft.Maui.Controls.ShellSection.OnChildAdded(Element child)  at at Microsoft.Maui.Controls.Element.AddLogicalChild(Element element)  at at Microsoft.Maui.Controls.ShellSection.AddPage(Page page)  at at Microsoft.Maui.Controls.ShellSection.OnPushAsync(Page page, Boolean animated)  at at Microsoft.Maui.Controls.ShellSection.PushStackOfPages(List`1 pages, Nullable`1 animate)  at at Microsoft.Maui.Controls.ShellSection.PrepareCurrentStackForBeingReplaced(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, Nullable`1 animate, List`1 globalRoutes, Boolean isRelativePopping)  at at Microsoft.Maui.Controls.ShellSection.GoToAsync(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, Nullable`1 animate, Boolean isRelativePopping)  at at Microsoft.Maui.Controls.ShellNavigationManager.GoToAsync(ShellNavigationParameters shellNavigationParameters, ShellNavigationRequest navigationRequest)  at at Nalu.ShellProxy.CommitNavigationAsync(Action completeAction)  at at Nalu.NavigationService.ExecuteRelativeNavigationAsync(INavigationInfo navigation, HashSet`1 disposeBag, IShellSectionProxy section, List`1 stack, Boolean sendAppearingToTarget, Boolean ignoreGuards, Func`1 onCheckingGuardAsync)  at at Nalu.NavigationService.<>c__DisplayClass14_0.<<GoToAsync>b__0>d.MoveNext()  at at Nalu.NavigationService.<>c__DisplayClass14_0.<<GoToAsync>b__0>d.MoveNext()  at at Nalu.NavigationService.ExecuteNavigationAsync(Func`1 navigationFunc)  at at Nalu.NavigationService.GoToAsync(INavigationInfo navigation)  at CaseyApp.ViewModels.OverviewPageViewModel.ShowCasesSearch() in /Users/Shared/develop/CaseyApp/CaseyApp/ViewModels/OverviewPageViewModel.cs:68 at at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task executionTask)  at at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:179 at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:2708 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:64 at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:96 at CaseyApp.Program.Main(String[] args) in /Users/Shared/develop/CaseyApp/CaseyApp/Platforms/iOS/Program.cs:13

@mackayn
Copy link

mackayn commented Sep 4, 2024

@PureWeen

Tried the nightly, I couldn't repo the navigation issue, had other issues such as setting the Date picker's binding to null kills the app where as 8.0.81-ci.net8.24413.37 it was fine but this is a nightly build so I'm aware it's WIP.

@PureWeen
Copy link
Member

PureWeen commented Sep 5, 2024

@mackayn

Do you have a repro for this one?

Tried the nightly, I couldn't repo the navigation issue, had other issues such as setting the Date picker's binding to null kills the app where as 8.0.81-ci.net8.24413.37 it was fine but this is a nightly build so I'm aware it's WIP.

Or can you paste the error trace here?

@mackayn
Copy link

mackayn commented Sep 6, 2024

@mackayn

Do you have a repro for this one?

Tried the nightly, I couldn't repo the navigation issue, had other issues such as setting the Date picker's binding to null kills the app where as 8.0.81-ci.net8.24413.37 it was fine but this is a nightly build so I'm aware it's WIP.

Or can you paste the error trace here?

Sorry, I'm away on vacation for a few weeks and don't have access to dev hardware, hence why I went with 8.0.81-ci.net8.24413.37 to get a working solution out to the client before my vacation time.

@PureWeen
Copy link
Member

PureWeen commented Sep 6, 2024

@PureWeen

Tried the nightly, I couldn't repo the navigation issue, had other issues such as setting the Date picker's binding to null kills the app where as 8.0.81-ci.net8.24413.37 it was fine but this is a nightly build so I'm aware it's WIP.

is this on Windows?

@reid-kirkpatrick
Copy link

@PureWeen I am seeing instances of this when running the 9 RC. Did this make not make it in? Any updated timeframe on SR9?

@pboisso
Copy link

pboisso commented Sep 17, 2024

FYI @PureWeen, still crashing here with latest 8.0.90 SR9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events fixed-in-8.0.82 fixed-in-8.0.90 fixed-in-9.0.0-rc.1.24453.9 i/regression This issue described a confirmed regression on a currently supported version p/0 Work that we can't release without platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

10 participants