VS Code won't stop on breakpoint
Actual Behavior
- Open React Native App
- Run Debug iOS
- Set a Breakpoint by clicking in the gutter
- Reload with CMD+R in the simulator
- Debugger does not stop on breakpoint
Expected Behavior
- I expect the debugger to stop on the breakpoint
Software versions
- React-Native VS Code extension version: 0.1.4
- VSCode version: 1.0
- OS platform and version: OS X El Capitan
- React Native version: 0.23
[vscode-react-native] Finished executing: react-native run-ios --simulator iPhone 5s [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.
@inturbidus Where are you putting the breakpoint (JavaScript code or react-native tags)? Can you trying setting a hard-breakpoint as in: "debugger;" in some javascript code and tell us if that breakpoint gets hit?
I have added several breakpoints for a test, here they are:
configureScene(route, routeStack){
-> if(route.type == 'Modal') {
return Navigator.SceneConfigs.FloatFromBottom
}
}
var NavigationBarRouteMapper = {
LeftButton(route, navigator, index, navState) {
-> if(index > 0) {
return (
<TouchableHighlight
underlayColor="transparent"
onPress={() => { if (index > 0) { navigator.pop() } }}>
<Text style={ styles.leftNavButtonText }>Back</Text>
</TouchableHighlight>)
}
else { return null }
}
class AboutYou extends React.Component {
_navigate(name,type) {
-> this.props.navigator.push(
{
name: 'Settings',
passProps: {
name: name
},
type: type
}
)
}
Can you try these two lines:
var NavigationBarRouteMapper = {
LeftButton(route, navigator, index, navState) {
console.log("Line where the breakpoint should be hit"); // These two lines
debugger; // These two lines
if(index > 0) {
return (
<TouchableHighlight
underlayColor="transparent"
onPress={() => { if (index > 0) { navigator.pop() } }}>
<Text style={ styles.leftNavButtonText }>Back</Text>
</TouchableHighlight>)
}
else { return null }
}
And tell me if the console line is printed on the VS Code Debug Console? And if the debugger stops at: "debugger;"?
I'm trying to figure out whether the issue is that VS Code is not properly connected to the debugger, or it's properly connected but the source mapping is not mapping the breakpoints you are setting correctly.
Also, could you please shake the device or simulator and tell me if the menu that appears says: "Disable Chrome Debugging" or "Enable Chrome Debugging"?
The debugger does stop on the debugger line and logs to the console.
The menu says "Disable Chrome Debugging"
It might be a source mapping issue. Can you please edit the launch configuration you are currently using in the launch.json file and add < , trace: "sm" > after the < "outDir": "${workspaceRoot}/.vscode/.react" > property)? That option will print debugging information regarding source maps.
Then can you remove all existing breakpoints (There is a menu for this if you right click on the Breakpoints panel in the Debug tab). Run your application, set a single breakpoint that's currently not being hit, and try to hit it.
Then please send us all the messages printed by the "trace": "sm" option (they'll appear on a different color), so we can try to figure out what's happening?
It turns out that my launch.json was missing: "sourceMaps": true, "outDir": "${workspaceRoot}/.vscode/.react",
The reason is that code reports that those params are not allowed, so I had deleted them. I put them back and the breakpoints are working.
Thank you guys so much! I'm really loving this setup now that it's working!
You're welcome! Please do send us any feedback/suggestions/issues you find :)
my first day # learning from other comment Thanks #digeff