Skip to content

[iOS] Application crashes when ToolbarItem is created with invalid IconImageSource name #27095

@nivetha-nagalingam

Description

@nivetha-nagalingam

Description

When creating a ToolbarItem with an IconImageSource property set to a name that doesn't correspond to any existing image resource in the project, the iOS application crashes with an unhandled ArgumentException. This occurs during the initialization of the ToolbarItem, preventing the application from launching successfully.
Note: While fixing this issue enable the test case from HostApp: Issue2222.

Image

Steps to Reproduce

  1. Issue2222.cs.zip
  2. Run the Application on an iOS
  3. Observe the Exception.

Expected Behavior:
The application should display the ToolbarItem without an icon, allowing the app to continue running without crashing, while potentially logging the image loading failure for debugging purposes.

Actual Behavior:
The application immediately crashes during startup with an unhandled System.ArgumentException stating "Unable to load image stream", preventing any user interaction with the app.

Link to public reproduction project repository

No response

Version with bug

9.0.22 SR2.2

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

iphone 18.0

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions