react-native-community / releases

React Native releases
https://github.com/facebook/react-native/
1.5k stars 407 forks source link

Hermes Debugger not stopping on breakpoints #250

Closed lunaleaps closed 2 years ago

lunaleaps commented 2 years ago

Version

0.66.0-rc.2

Developer Environment

macOS, Intel,

Issue and Reproduction Steps

When attempting to set breakpoints in devtools they are not hitting but debugger statements do.

Steps to repro:

  1. npx react-native init --version 0.66.0-rc.2 MyTestProject662 and start metro npm start
  2. Follow hermes debugging steps (but click on the React Native experimental target)
  3. Set a breakpoint via devtools in App.js and see if it hits

Expected:

Note:

fabOnReact commented 2 years ago

I made a quick investigation, but I don't know this part of the codebase. Sorry

https://github.com/facebook/react-native/tree/main/ReactCommon/hermes/inspector/chrome

- (BOOL)isRemoteDebuggingAvailable
{
  if (RCTTurboModuleEnabled()) {
    return NO;
  }
  Class jsDebuggingExecutorClass = objc_lookUpClass("RCTWebSocketExecutor");
  return (jsDebuggingExecutorClass != nil);
}

https://github.com/facebook/react-native/blob/f085e09be5a148065d286ba3950324dc9e44b7f6/React/CoreModules/RCTDevSettings.mm#L269-L276

https://github.com/facebook/react-native/commit/75f2da23c5d557862cf4b7bcdd8a1445b54d1c31

  public void setRemoteJSDebugEnabled(final boolean isRemoteJSDebugEnabled) {
    if (!mIsDevSupportEnabled) {
      return;
    }

    UiThreadUtil.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            mDevSettings.setRemoteJSDebugEnabled(isRemoteJSDebugEnabled);
            handleReloadJS();
          }
        });
  }

https://github.com/facebook/react-native/blob/ef6ad1f2d65639a1d41e05a895ad21ce97192749/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java#L1033-L1046

fkgozali commented 2 years ago

@fabriziobertoglio1987 that code is for the old "Chrome debugging flow", not for Flipper debugger for Hermes

numandev1 commented 2 years ago

@fkgozali can we add Hermes debugging in devsetting cmd+D instead of React Native Experiment inspect?

kelset commented 2 years ago

Closing off since we are deprecating the repo - if the problem persists please open an issue either in react-native core, or the hermes repo.