Skip to content

Specifying HeightRequest in Webview when wrapped by ScrollView set "invisible" causes crash in iOS #26795

Open
@bobwhitten

Description

@bobwhitten

Description

e.g., Add this to MAUI template project:

            <ScrollView x:Name="myMediaFrame" 
                IsVisible="False"
                >
                <WebView x:Name="myWebView" 
                    HeightRequest="1000"
                    />
            </ScrollView>

This results in this on startup (in my app, when the page appeared):

ObjCRuntime.ObjCException
Message=Objective-C exception thrown. Name: CALayerInvalidGeometry Reason: CALayer position contains NaN: [22 nan]. Layer: <CALayer:0x30034e780; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <Microsoft_Maui_Platform_MauiWKWebView: 0x11640b000; frame = (0 0; 0 0); backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x30034e780>>; sublayers = (<CALayer: 0x300376cc0>); allowsGroupOpacity = YES; backgroundColor = <CGColor 0x30266d9a0> [<CGColorSpace 0x30211e580> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 0 0 )>

Removing EITHER IsVisible="False" from VerticalStackLayout OR HeightRequest="1000" from WebView prevents crash.

This behavior did not happen in Windows.
This particular behaviour does not slow me down, but it was certainly unexpected, and took some time to find.

Steps to Reproduce

Run reproduction project. Observe crash.
Modify as noted above, observe no crash.

Link to public reproduction project repository

https://github.com/bobwhitten/DemoWebView

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iPadOS 18.2, 17.5.1

Did you find any workaround?

Either do not start Invisible, or do not set height request.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions