Skip to content

Controlled multiline TextInput crashes with access violation (0xc0000005) #15801

@ericfle

Description

@ericfle

Problem Description

A conditionally-rendered controlled multiline TextInput crashes the app with an access violation. The crash is triggered by DrawBlock::~DrawBlock calling DrawText(), which re-enters msftedit and calls ConvertLocalToScreen on an invalid ReactNativeIsland weak reference.

The crash can manifest at different lifecycle points depending on the app's complexity and timing:

  • In a minimal app, it crashes on mount (the ReactNativeIsland isn't fully set up yet)
  • In a larger app, mount may succeed but the crash occurs when unmounting a focused multiline TextInput (the island's weak ref is already freed during teardown)

Crash details
ExceptionCode: c0000005 (Access violation)
FAILURE_ID_HASH: {3d4c5424-d3a0-a029-b29e-00b71a707531}

x86: Attempt to read from address 0x000001dc
x64: Attempt to read from address 0x0000000000000358

Stack:

  msftedit!CTxtEdit::OnTxInPlaceActivate
    → msftedit!CUIM::GetScreenExt
      → textinputframework callbacks
        → RootComponentView::ConvertLocalToScreen
          → m_wkRootView.get() → invalid IWeakReference → CRASH

Steps To Reproduce

Minimal Repro

import React, {useState} from 'react';
import {View, Text, Pressable} from 'react-native';
import {TextInput} from 'react-native-windows';

function App() {
  const [show, setShow] = useState(false);
  const [text, setText] = useState('');

  return (
    <View style={{flex: 1, padding: 20}}>
      <Pressable onPress={() => setShow(!show)}>
        <Text>{show ? 'Close' : 'Open'}</Text>
      </Pressable>
      {show && (
        <TextInput
          value={text}
          onChangeText={setText}
          multiline
          style={{borderWidth: 1, minHeight: 60}}
        />
      )}
    </View>
  );
}

export default App;

Steps: Click "Open" → app crashes.

What works (no crash)

  • Removing multiline — single-line controlled TextInput works fine
  • Removing value/onChangeText — uncontrolled multiline TextInput works fine

Expected Results

No response

CLI version

20.0.0

Environment

System:
  OS: Windows 11 10.0.22631
  CPU: (8) x64 Intel(R) Xeon(R) Platinum 8488C
  Memory: 13.43 GB / 31.37 GB
Binaries:
  Node:
    version: 23.11.1
    path: D:\Users\...\AppData\Local\nvs\default\node.exe
  Yarn: Not Found
  npm:
    version: 11.4.2
    path: D:\Users\...\AppData\Local\nvs\default\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.37012.4 (Visual Studio Professional 2022)
    - 16.11.36631.11 (Visual Studio Professional 2019)
    - 18.3.11512.155 (Visual Studio Professional 2026)
Languages:
  Java: Not Found
  Ruby:
    version: 3.0.2
    path: C:\tools\ruby30\bin\ruby.exe
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.82.0
    wanted: 0.82.0
  react-native-windows:
    installed: 0.82.0
    wanted: ^0.82.0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

No response

Target React Native Architecture

None

Target Platform Version

None

Visual Studio Version

None

Build Configuration

None

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

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions