react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Fix XamlRoot crashes in FlyoutViewManager

Open rozele opened this issue 1 year ago • 0 comments

Description

Type of Change

Erase all that don't apply.

  • Bug fix (non-breaking change which fixes an issue)

Why

There are two cases where a flyout may crash when opened:

  1. If the native view corresponding to the target tag is unmounted before the flyout is shown.
  2. If the XamlRoot on the flyout differs from the XamlRoot of the target.

This can happen if the XamlRoot changes (e.g., window loses focus) before the UIManager operation to create the Flyout and set the isOpen prop executes.

Note - this is only relevant to multi-window RN applications.

What

This change logs the error and does not attempt to show the flyout if either of these cases occur.

Testing

This change has been in production in Messenger Desktop for more than a year and has fixed a significant crash that occurred when attempting to show a flyout just before opening a call window.

Microsoft Reviewers: Open in CodeFlow

rozele avatar Jul 25 '22 21:07 rozele