Skip to content

App crashes after creating a Modal and then moving the window #15165

@chrisglein

Description

@chrisglein

Problem Description

There seems to be an issue with Modal dialogs. Create one and then try to move either window and you can get a crash (details below).

Theory of what's going on:

  1. A popup bridge is created and opened and an island gets attached to it
  2. Later the popup gets closed
  • The popup gets marked as hidden
  • The island is disposed
  • The popup clears out a bunch of state
    -‼️Either we accidentally leak the bridge, or the app hangs on to the bridge
  1. Later the top level window gets moved
  • It asks the popup whether its state is in sync with the top level window
  • Of course it's not - the popup is in a pseudo destroyed state
  • Boom💥

While we're chasing down whether there's an underlying issue here, recommended framework-side workaround:

Disposing the island from the popup seems to be the trigger. Call dispose on the popup bridge instead and just release your references to the island instead of calling dispose.

Steps To Reproduce

chrisglein/artificial-chat
Repro:

  • launch app
  • click ellipses to get the dialog and choose settings
  • then try to move the main window

onecoreuap\windows\moderncore\inputv2\inputhost\outside\lifted\contentappwindowbridge.cpp(818)\Microsoft.UI.Input.dll!00007FFCE754BC02: (caller: 00007FFCE754BEF9) FailFast(1) tid(8874) 8000FFFF Catastrophic failure
Unhandled exception at 0x00007FFCE754BC02 (Microsoft.UI.Input.dll) in Artificial Chat.exe: Fatal program exit requested.

Top frames of the callstack:

      KernelBase.dll!RaiseFailFastException(_EXCEPTION_RECORD * pExceptionRecord, _CONTEXT * pContextRecord, unsigned long dwFlags) Line 1216   C
      Microsoft.UI.Input.dll!wil::details::WilDynamicLoadRaiseFailFastException(_EXCEPTION_RECORD * er, _CONTEXT * cr, unsigned long flags) Line 2595 C++
      Microsoft.UI.Input.dll!wil::details::WilRaiseFailFastException(_EXCEPTION_RECORD * er, _CONTEXT * flags, unsigned long cr) Line 2528      C++
      Microsoft.UI.Input.dll!wil::details::WilFailFast(const wil::FailureInfo & failure) Line 4499    C++
      Microsoft.UI.Input.dll!wil::details::ReportFailure_NoReturn<3>(void * callerReturnAddress, unsigned int lineNumber, const char * fileName, const char * returnAddress, const char * resultPair, void * message, const wil::details::ResultStatus &) Line 4566     C++
      Microsoft.UI.Input.dll!wil::details::ReportFailure_Base<3,0>(void * callerReturnAddress, unsigned int lineNumber, const char * fileName, const char * returnAddress, const char * resultPair, void * message, const wil::details::ResultStatus & functionName, const wchar_t * code, wil::details::ReportFailureOptions options) Line 4592      C++
      Microsoft.UI.Input.dll!wil::details::ReportFailure_Hr<3>(void * callerReturnAddress, unsigned int lineNumber, const char * fileName, const char * returnAddress, const char * hr, void * functionName, HRESULT code) Line 4775      C++
      Microsoft.UI.Input.dll!wil::details::in1diag3::FailFast_Unexpected(void * callerReturnAddress, unsigned int lineNumber, const char * fileName) Line 6413    C++
      [Inline Frame] Microsoft.UI.Input.dll!wil::details::in1diag3::FailFast_If(void * callerReturnAddress, unsigned int) Line 6427 C++
>     Microsoft.UI.Input.dll!ContentAppWindowBridge::PopulateContentSiteEnvironment(ContentAppWindowBridge::ContentSiteEnvironmentListener listener, DesktopTopLevelChanges changes) Line 818   C++
      [Inline Frame] Microsoft.UI.Input.dll!ContentAppWindowBridge::NotifyContentSiteEnvironmentListeners::__l5::<lambda_530a7bd4f823031b94fbd308948a3fc7>::operator()(ContentAppWindowBridge::ContentSiteEnvironmentListener) Line 900   C++
      [Inline Frame] Microsoft.UI.Input.dll!std::for_each(std::_List_iterator<std::_List_val<std::_List_simple_types<ContentAppWindowBridge::ContentSiteEnvironmentListener>>>) Line 258  C++
      [Inline Frame] Microsoft.UI.Input.dll!ContentAppWindowBridge::NotifyContentSiteEnvironmentListeners(DesktopTopLevelChanges changes) Line 895    C++
      Microsoft.UI.Input.dll!ContentAppWindowBridge::ProcessChanges(DesktopTopLevelChanges includedChanges) Line 1031   C++

Expected Results

No crash

CLI version

19.1.1

Environment

System:
  OS: Windows 11 10.0.27944
  CPU: "(24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores     "
  Memory: 36.79 GB / 63.86 GB
Binaries:
  Node:
    version: 18.18.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.19
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 9.8.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.22621.0
      - 10.0.26100.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.36408.4 (Visual Studio Community 2022)
Languages:
  Java: Not Found
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 19.1.1
    wanted: 19.1.1
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.2
    wanted: 0.80.2
  react-native-windows:
    installed: 0.80.0-preview.6
    wanted: 0.80.0-preview.6
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

None

Target React Native Architecture

New Architecture (WinAppSDK) Only

Target Platform Version

None

Visual Studio Version

None

Build Configuration

None

Snack, code example, screenshot, or link to a repository

chrisglein/artificial-chat

Metadata

Metadata

Assignees

Labels

Area: FabricSupport Facebook FabricArea: ModalNew ArchitectureBroad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabricbug

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions