microsoft / microsoft/fluentui-apple

Tooltip could crash during runtime because of `preconditionFailure()`

Open
#611 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
977
Forks
180
Avg merge
21h 38m
Merged PRs (30d)
1

Description

Environment Information
  • Platform:
    • iOS: any
    • macOS: any
  • Package version(s): (fill this out, include which package manager you're using): latest
  • Xcode and OS versions: (fill this out if relevant): any version supported
Please provide a reproduction of the bug:

The anchorView's window can be nil when it got removed from the view hierarchy.
In this situation, preconditionFailure() will lead to runtime crash.

Since Tooltip isn't a critical UI for most business logic, should we crash the app when this exception happens?

I searched for preconditionFailure() in this repo (https://github.com/microsoft/fluentui-apple/search?p=1&q=preconditionFailure) and found that most of its use is for unimplemented initializers.

Actual behavior:

Tooltip could crash the app.

Expected behavior:

This UI component shouldn't crash app. Or at least, we can have an alternative to crash (runtime error log?)

Priorities and help requested:

Are you willing to submit a PR to fix? No. Or yes if we have a clear path to fix it.

Requested priority: Normal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the Tooltip implementation for preconditionFailure and inspect the anchorView/window handling; reproduce the case after the view leaves the hierarchy. Done means the component no longer crashes in that situation and the chosen alternative behavior is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
desktop, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.