Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode cannot catch when the breakpoint is reached #334

Closed
vonweb opened this issue Nov 8, 2016 · 8 comments
Closed

VSCode cannot catch when the breakpoint is reached #334

vonweb opened this issue Nov 8, 2016 · 8 comments

Comments

@vonweb
Copy link

vonweb commented Nov 8, 2016

Actual Behavior

  1. In emulator the breakpoint has reached, the process is blocked, but vscode cannot catch it

Expected Behavior

  1. breackpoint reach, vscode immediately come to front, shows information at the breakpoint

Software versions

  • React-Native VS Code extension version: 0.2.2
  • VSCode version: 1.7.1
  • OS platform and version: win10 1607
  • React Native version: 0.36.1
  • React Native Cli version: 1.0.0

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
    Debugger listening on [::]:48864
    [vscode-react-native] Downloaded debuggerWorker.js (Logic to run the React Native app) from the Packager.
    [vscode-react-native] Starting debugger app worker.
    [vscode-react-native] Established a connection with the Proxy (Packager) to the React Native application
    [vscode-react-native] Debugging session started successfully.
    Running application "ReactNativeTS" with appParams: {"initialProps":{},"rootTag":1}. DEV === true, development-level warning are ON, performance optimizations are OFF
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
    Getting exponent dependecy.
    ######### Checking react native is correctly setup. This may take a while... ##########
    Checking if the correct react native is installed..
    ######### Starting Packager ##########
    ######### Executing command: react-native.cmd start --port 8081 ##########
    [Error : 0106] Failed to start the React Native packager: Could not start the packager.
    Scanning 583 folders for symlinks in e:\WorkSpace\ReactNativeTS\node_modules (298ms)
    ┌────────────────────────────────────────────────────────────────────────────┐
    │ Running packager on port 8081. │
    │ │
    │ Keep this packager running while developing on any JS projects. Feel │
    │ free to close this tab and run your own packager instance if you │
    │ prefer. │
    │ │
    https://github.com/facebook/react-native
    │ │
    └────────────────────────────────────────────────────────────────────────────┘
    Looking for JS files in
    e:\WorkSpace\ReactNativeTS

[Hot Module Replacement] Server listening on /hot

React packager ready.

[2016-11-08 16:55:26] Requesting bundle: {"url":"/index.android.bundle?platform=android"}
[2016-11-08 16:55:58] Initializing Packager
[2016-11-08 16:55:58] Building in-memory fs for JavaScript
[2016-11-08 16:55:58] Building in-memory fs for JavaScript (124ms)
[2016-11-08 16:55:58] Building Haste Map
[2016-11-08 16:55:58] Building Haste Map (117ms)
[2016-11-08 16:55:58] Initializing Packager (310ms)
[2016-11-08 16:55:58] Transforming modules
[2016-11-08 16:56:01] Transforming modules (3201ms)
######### The Bundle Cache was prewarmed. ##########
[2016-11-08 16:56:01] Requesting bundle: {"url":"/index.android.bundle?platform=android"} (35735ms)
[2016-11-08 16:56:43] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"}
[2016-11-08 16:56:43] Transforming modules
[2016-11-08 16:56:45] Transforming modules (1358ms)
[2016-11-08 16:56:45] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"} (1546ms)
Starting custom debugger by executing: echo A debugger is not needed: "e:\WorkSpace\ReactNativeTS"
Starting custom debugger by executing: echo A debugger is not needed: "e:\WorkSpace\ReactNativeTS"
[2016-11-08 16:56:50] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"}
[2016-11-08 16:56:50] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"} (20ms)
[2016-11-08 16:56:50] Requesting bundle: {"url":"/index.android.map?platform=android&dev=true&hot=false&minify=false"}
[2016-11-08 16:56:50] Requesting bundle: {"url":"/index.android.map?platform=android&dev=true&hot=false&minify=false"} (9ms)
Starting custom debugger by executing: echo A debugger is not needed: "e:\WorkSpace\ReactNativeTS"
[2016-11-08 16:58:58] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"}
[2016-11-08 16:58:58] Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"} (26ms)
[2016-11-08 16:58:58] Requesting bundle: {"url":"/index.android.map?platform=android&dev=true&hot=false&minify=false"}
[2016-11-08 16:58:58] Requesting bundle: {"url":"/index.android.map?platform=android&dev=true&hot=false&minify=false"} (14ms)

  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
    /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:121 [Extension Host] processWorkspaceFiles Array[4]0: Object1: Object2: Object3: Objectlength: 4__proto__: Array[0] true false
    /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:121 [Extension Host] processWorkspaceFiles Array[1] false true
@vladimir-kotikov
Copy link
Contributor

@vonweb, what version of NodeJS are you running on? Also could you provide a sample app where the problem can be reproduced?

@vonweb
Copy link
Author

vonweb commented Nov 9, 2016

@vladimir-kotikov node is v6.9.1, and I cloned from https://github.com/mrpatiwi/ReactNativeTS, breakpoint is set at src/components/HelloWorld/index.tsx:30
when debugging with generated js vscode cannot catch either
at first the bundle map is not target to tsx, I changed sourceMap to inlineSourceMap in tsconfig.json

@vladimir-kotikov
Copy link
Contributor

Thanks for details. At first look it sounds like #273, but with some differences:

  • hitting 'pause' in debugger panel does not have any effect in Node 6.x - app's UI remains frozen but VSCode doesn't stop at the breakpoint

  • in Node 7.x when app "stops" at the breakpoint, error message is logged to debug console:

    #
    # Fatal error in runtime\runtime-debug.cc, line 1423
    # Check failed: args[0]->IsJSObject().
    #
    
    ==== C stack trace ===============================
    
    v8::Testing::DeoptimizeAll [0x00007FF7919FD346+1835286]
    v8::Testing::DeoptimizeAll [0x00007FF791BA9EFD+3591373]
    (No symbol) [0x00000346FD5063AB]
    
    

This sounds like another bug with Node, so we'd need to report this to NodeJS team

@vladimir-kotikov
Copy link
Contributor

Upd.: On Node 7.x breakpoint event is successfully reported by Node, but right after that one of debug adapter requests (variables, stack, etc.) causes node to crash. Not sure yet, whether this is still an issue with Node or vscode-node-debug extension is to blame.

As a workaround you can switch to Node 4.x, which seems to work fine

@vonweb
Copy link
Author

vonweb commented Nov 11, 2016

thanks for your reply, I tried node v4.6.2, with react-native-cli: 1.2.0, react-native: 0.37.0 but I run into some other problems.
in debug console I get:
[vscode-react-native] [Warning] Failed to prepare the JavaScript runtime environment. Message:
[object Object]. Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

in vscode console I get:
[Extension Host] processWorkspaceFiles Array[4]0: Object$mid: 1authority: ""external: "file:///e%3A/WorkSpace/myTsRnProject/src/declarations.d.ts"fragment: ""fsPath: "e:\WorkSpace\myTsRnProject\src\declarations.d.ts"path: "/e:/WorkSpace/myTsRnProject/src/declarations.d.ts"query: ""scheme: "file"proto: Object1: Object2: Object3: Objectlength: 4__proto__: Array[0] true false
shell.ts:440Node.js 未在合理的时间内响应请求“listbreakpoints”。: Error: Node.js 未在合理的时间内响应请求“listbreakpoints”。
at file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:87:15727
at Object.v [as _notify](file:///C:/Program Files %28x86%29/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:31:10797)
at Object.enter (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:31:14302)
at _run (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:31:15623)
at _error (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:31:15140)
at file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:82:21162
at t.e.dispatch (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:82:22507)
at t.e.handleData (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:82:22019)
at Socket. (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:82:21022)
at emitOne (events.js:96:13)e.onUnexpectedError @ shell.ts:440
winjs.base.js:45WARNING: Promise with no error callback:75
winjs.base.js:46Object

@vonweb
Copy link
Author

vonweb commented Nov 11, 2016

@vladimir-kotikov can you really debug with node v4, in #311 node must be v6, I can package with node v4, but cannot debug with it in vscode

@vladimir-kotikov
Copy link
Contributor

Yeah, you probably right

The debugger crash on Node 7.x is also being tracked here

@vladimir-kotikov
Copy link
Contributor

This issue has been fixed by switching to node2 debugging engine in #390. @MSLaguana, can we close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants