nativescript-community / nativescript-vscode-extension

A Visual Studio Code Extension for NativeScript
https://www.nativescript.org/visual-studio-code
Apache License 2.0
82 stars 32 forks source link

Breakpoint not hit with launch options in OSX but attach #207

Open tsonevn opened 6 years ago

tsonevn commented 6 years ago

From @DavoBR on September 14, 2018 1:18

tns doctor result:

DAVID-MAC:~ davo$ tns doctor ✔ Getting environment information

No issues were detected. ✔ Your ANDROID_HOME environment variable is set and points to correct directory. ✔ Your adb from the Android SDK is correctly installed. ✔ The Android SDK is installed. ✔ A compatible Android SDK for compilation is found. ✔ Javac is installed and is configured properly. ✔ The Java Development Kit (JDK) is installed and is configured properly. ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly. ✔ The Python 'six' package is found. ✔ Getting NativeScript components versions information... ✔ Component nativescript has 4.2.3 version and is up to date.

VSCode version: 1.27.2

Symptoms:

  1. Breakpoint not hit when a i choose "Launch on iOS" options to start debug but work when i choose "Attach on iOS"

  2. I get this when start debug in VSCode

Traceback (most recent call last):

File "", line 1, in

File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in import weakref

File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in from _weakref import (

ImportError: cannot import name _remove_dead_weakref

TypeError: Cannot set property 'deviceIdentifier' of undefined at SocketProxyFactory. (/Users/davo/.nvm/versions/node/v10.10.0/lib/node_modules/nativescript/lib/device-sockets/ios/socket-proxy-factory.js:88:46) at Generator.throw () at rejected (/Users/davo/.nvm/versions/node/v10.10.0/lib/node_modules/nativescript/lib/device-sockets/ios/socket-proxy-factory.js:5:65)

Copied from original issue: NativeScript/NativeScript#6265

tsonevn commented 6 years ago

Hi @DavoBR, Can you check if you are using the latest version of nativescript vs code extension - 0.8.1? Also, does this happen when deploying the app on a device or on a simulator? I tested the VSCode debugging with Launch on iOS option and the project stopped on the breakpoint.

DanHef commented 5 years ago

Hi @tsonevn,

I am having the same issue. For me I have the newest code extension installed (0.8.1) and tried it with the latest nativescript version (4.2.4) and the nativescript RC 4.2.4-2018-09-17-12236. I used node version 10.11.0. For me it happens when deploying on a simulator, didn't have the chance to try deploying it to a device in this setup yet.

DavoBR commented 5 years ago

Hi @DavoBR, Can you check if you are using the latest version of nativescript vs code extension - 0.8.1? Also, does this happen when deploying the app on a device or on a simulator? I tested the VSCode debugging with Launch on iOS option and the project stopped on the breakpoint.

the first time I had installed node 8.12.0 now I install version 10.11.0 but likewise the error persists.

this is the output of vscode after start debug


Version: 0.8.2
Build version: v.2018.9.12.1
Commit id: fdc029cb4f62a67dfc3df1555910189c91cf15e9
NativeScript CLI: 4.2.4
[NativeScriptCli] execute: tns --analyticsClient VSCode --version
[NSDebugAdapter] Using tns CLI v4.2.4 on path 'tns'

[NSDebugAdapter] Running tns command...

[NativeScriptCli] execute: tns --analyticsClient VSCode debug ios --watch 
[NSDebugAdapter] Watching the tns CLI output to receive a connection token

Searching for devices...

Executing before-liveSync hook from /Users/davo/Dev/Projects/HelloWorld/hooks/before-liveSync/nativescript-angular-sync.js

Executing before-watchPatterns hook from /Users/davo/Dev/Projects/HelloWorld/hooks/before-watchPatterns/nativescript-dev-typescript.js

Executing before-watch hook from /Users/davo/Dev/Projects/HelloWorld/hooks/before-watch/nativescript-dev-typescript.js

Found peer TypeScript 2.7.2

Skipping prepare.

Successfully transferred all files.

org.nativescript.HelloWorld: org.nativescript.HelloWorld: 13185

Setting up debugger proxy...
Press Ctrl + C to terminate, or disconnect.

Opened localhost 41000

To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/remote/serve_file/@02e6bde1bbe34e43b309d4ef774b1168d25fd024/inspector.html?experiments=true&ws=localhost:41000

[NSDebugAdapter] Ready to attach to application on 41000

Frontend client connected.

TypeError: Cannot set property 'deviceIdentifier' of undefined
    at SocketProxyFactory.<anonymous> (/Users/davo/.nvm/versions/node/v10.11.0/lib/node_modules/nativescript/lib/device-sockets/ios/socket-proxy-factory.js:88:46)
    at Generator.throw (<anonymous>)
    at rejected (/Users/davo/.nvm/versions/node/v10.11.0/lib/node_modules/nativescript/lib/device-sockets/ios/socket-proxy-factory.js:5:65)

[NSDebugAdapter] The tns command finished its execution with code 120.

The tns command finished its execution with code 120```
racknoris commented 5 years ago

Is there a way to solve it? Same happens to me when I tns debug ios from the terminal without VScode

tsonevn commented 5 years ago

Hi @racknoris, Can you try restarting the device and simulator, that you are using for debugging then start again the tns debug ios command?

JonLevy commented 5 years ago

Edit: It turned out I needed to brew uninstall and reinstall python. Now it is working.

The problems initially:

tns debug ios is working for me, but not the VSCode extension.

When trying to use the extension, the debugger fails to attach. Here is a sample output:

[NSDebugAdapter] Running tns command...

[NativeScriptCli] execute: tns --analyticsClient VSCode debug ios --watch --debug-brk 
[NSDebugAdapter] Watching the tns CLI output to receive a connection token

Searching for devices...

Found peer TypeScript 3.1.6

Skipping prepare.

Successfully transferred all files on device 35B23925-5E95-4252-A292-525229B27EE5.

Restarting application on device 35B23925-5E95-4252-A292-525229B27EE5...

org.nativescript.roilApp: org.nativescript.roilApp: 3504

Setting up debugger proxy...
Press Ctrl + C to terminate, or disconnect.

Opened localhost 41002

To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:41002

Successfully synced application org.nativescript.roilApp on device 35B23925-5E95-4252-A292-525229B27EE5.

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

[NSDebugAdapter] Ready to attach to application on 41002

Frontend client connected.

NativeScript debugger has opened inspector socket on port 18183 for org.nativescript.roilApp.

NativeScript waiting for debugger.

Cannot connect to device socket. The error message is 'Timeout while waiting for lock "/Users/jonathanlevy/.local/share/.nativescript-cli/54989e3d05a7e989423bfa34a89660c2"'.