microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.26k stars 1.14k forks source link

AlertModule::showAlert crashes in Xaml Islands #4194

Open htpiv opened 4 years ago

htpiv commented 4 years ago

Environment

Steps to Reproduce

  1. Open packages\playground\windows\playground-win32.sln
  2. Hit F5 (Build solution & start debugging)
  3. Press CTRL+O (File->Open)
  4. Select "Samples\rntester" & click "OK"
  5. Click on "\<Button>\nSimple React Native button component"
  6. Click on the button labeled "Press Me"

Expected Behavior

A ContentDialog would pop up.

Actual Behavior

Playground Win32 crashes The problem appears to be related to Xaml Islands; the ContentDialog needs to be told what XamlRoot to use, but the AlertModule has no context to use to find a root.

chrisglein commented 4 years ago

There's likely some quick work to have some reasonable default here (and not crash). But as we get multiple islands (or no active root views) then there's work to figure out what to do. For no active view we probably need to create on on the fly on their behalf.