microsoft / microsoft/react-native-windows

Can't direct debug Hermes when consuming the Microsoft.ReactNative nuget packages

Open
#11,252 1 comment 1 reaction 1 assignee View on GitHub

@vmoroz is already working on this.

Since Feb 23, 2023.

Area: Debug Infrastructure Area: JavaScript Engine bug Scenario: NuGet Workstream: Developer Experience
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

In order for Hermes direct debugging to work, the RNW code needs to set up the Hermes Inspector (which connects to Metro for source maps). However the code in Microsoft.ReactNative is #ifdef HERMES_ENABLE_DEBUGGER:

https://github.com/microsoft/react-native-windows/blob/8eee65d4bc2e086c7170be4ae29d6df664d5ced9/vnext/Shared/DevSupportManager.cpp#L243-L267

This compile time flag is set by the targets file for the hermes-windows nuget (when building debug or by setting a property to build in release flavor too):

https://github.com/microsoft/hermes-windows/blob/7606e2f393372b7018a734ac70c4b151ff7929e6/.ado/ReactNative.Hermes.Windows.targets#L26

However this means its only applied when building RNW from source. The RNW nuget packages are built in release flavor.

Note, this is blocked by the fact that you can't even use Hermes with the RNW nugets at all (see #11251) but even if that were fixed, there'd still be extra work to allow direct debugging since it's behind HERMES_ENABLE_DEBUGGER.

Steps To Reproduce
  1. Build a new RNW app with the experimental nugets and hermes
  2. Run the new app with direct debugging enabled
Expected Results

Able to connect a direct debugger.

CLI version

npx react-native --version

Environment
info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.25300
    CPU: (24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores
    Memory: 51.33 GB / 63.86 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0, 10.0.22000.0, 10.0.22621.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.11.33214.272 (Visual Studio Enterprise 2019), 17.4.33213.308 (Visual Studio Enterprise 2022)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0 => 0.71.0
    react-native-windows: 0.71.1 => 0.71.1
  npmGlobalPackages:
    *react-native*: Not Found
Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

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

No response

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.