Skip to content

'Microsoft.Maui.Platform.ContentView' does not have a constructor that takes one NativeHandle argument #23139

@softlion

Description

@softlion

Description

I see that error in Sentry.

Failed to marshal the Objective-C object 0x143c0ffe0 (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).

The stack trace is:

id Runtime.MissingCtor(IntPtr, IntPtr, Type, MissingCtorResolution, IntPtr, RuntimeMethodHandle)
In App

UIView Runtime.ConstructNSObject<UIView>(IntPtr, Type, MissingCtorResolution, IntPtr, RuntimeMethodHandle)
In App

UIView Runtime.GetNSObject<UIView>(IntPtr, IntPtr, RuntimeMethodHandle, bool) x 3
In App

Called from: UIView UIView.get_Superview()

Show 17 more frames

void MaterialTextField.AnimateToInactiveOrFocusedState(bool animate)

Where MaterialTextField is a custom control, and AnimateToInactiveOrFocusedState creates an Animation object to animate some properties of existing UI objects. Nothing special.

Steps to Reproduce

Not sure.
But it looks like it is related to The RealParent on Microsoft.Maui.Controls.Button has been Garbage Collected. This should never happen. Please log a bug: https://github.com/dotnet/maui

Link to public reproduction project repository

No response

Version with bug

8.0.60 SR6

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

All

Did you find any workaround?

no

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterplatform/iospotential-regressionThis issue described a possible regression on a currently supported version., verification pendings/needs-reproAttach a solution or code which reproduces the issuet/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions