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

Debugger detaches during live sync after encountering an runtime error on iOS #201

Open VladimirAmiorkov opened 6 years ago

VladimirAmiorkov commented 6 years ago

HI,

Since 4.2.1 and now 4.2.2 of NativeScript and tns-ios: 4.2.0 I have started noticing that the VS Code extension debugger is detaching itself if it encounters an runtime error (tested with error in TypeScript). This same scenario does not hit the same issue if I use Chrome Dev tools to debug (tns debug iOS). Also tested this with the current internal version of the extension.

Here are the steps to reproduce:

  1. In your code make a null reference error: I tested it with simply collating a method on something that is undefined
  2. Hit that part of the code (I did it in the coated of RadListView's itemSwipeProgressChanged event using this sample)
  3. An error is thrown but its should not crash the app
  4. Fix the issue in the TypeScript and save the file
  5. Live sync triggers and prepares the project but detaches the debug session before refreshing the app in the simulator

Here is the callback from the official 0.8.0 version of the extension:

[NSDebugAdapter] Using tns CLI v4.2.2 on path 'tns' [NSDebugAdapter] Running tns command... [NSDebugAdapter] Using iOS Team ID 'W7TGC3P93K', you can change this in the workspace settings. [NSDebugAdapter] Watching the tns CLI output to receive a connection token Searching for devices... Executing before-liveSync hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-liveSync/nativescript-angular-sync.js Executing before-watchPatterns hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-watchPatterns/nativescript-dev-typescript.js Executing before-watchPatterns hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-watchPatterns/nativescript-dev-webpack.js Executing before-watch hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-watch/nativescript-dev-typescript.js Found peer TypeScript 2.8.4 app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. Executing before-watch hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-watch/nativescript-dev-webpack.js Executing before-shouldPrepare hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-shouldPrepare/nativescript-dev-webpack.js Executing before-prepare hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-prepare/nativescript-dev-typescript.js Hook skipped because either bundling or livesync is in progress. Preparing project... Executing before-prepareJSApp hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/before-prepareJSApp/nativescript-dev-webpack.js 9:32:13 AM - File change detected. Starting incremental compilation... app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:32:16 AM - Compilation complete. Watching for file changes. 9:32:28 AM - File change detected. Starting incremental compilation... app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:32:30 AM - Compilation complete. Watching for file changes. 9:32:34 AM - File change detected. Starting incremental compilation... app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:32:35 AM - Compilation complete. Watching for file changes. 9:32:59 AM - File change detected. Starting incremental compilation... app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:33:00 AM - Compilation complete. Watching for file changes. 9:33:03 AM - File change detected. Starting incremental compilation... app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:33:04 AM - Compilation complete. Watching for file changes. Project successfully prepared (iOS) Executing after-prepare hook from /Users/amiorkov/Desktop/Work/nativescript-ui-listview/demo-angular/hooks/after-prepare/nativescript-dev-webpack.js app/examples/item-selection/listview-item-selection.component.ts(48,41): error TS1109: Expression expected. 9:33:11 AM - Compilation complete. Watching for file changes. Successfully transferred all files. org.nativescript.demoangular: org.nativescript.demoangular: 84043 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. NativeScript debugger has opened inspector socket on port 18183 for org.nativescript.demoangular. Backend socket created. CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:1:82: Loading inspector modules... CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:6:12: Finished loading inspector modules. NativeScript debugger attached. Loading inspector modules... Finished loading inspector modules. (demoangular) Created Activity ID: 0x22b130, Description: Loading Preferences From System CFPrefsD For Search List (demoangular) Created Activity ID: 0x22b131, Description: Loading Preferences From System CFPrefsD For Search List CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:1:82: Loading inspector modules... CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:6:12: Finished loading inspector modules. NativeScript debugger attached. Loading inspector modules... Finished loading inspector modules. (demoangular) Created Activity ID: 0x22b130, Description: Loading Preferences From System CFPrefsD For Search List (demoangular) Created Activity ID: 0x22b131, Description: Loading Preferences From System CFPrefsD For Search List (demoangular) Created Activity ID: 0x22b132, Description: Loading Preferences From System CFPrefsD For Search List (libAccessibility.dylib) [com.apple.Accessibility:AccessibilitySupport] Retrieving resting unlock: 0 Angular is running in the development mode. Call enableProdMode() to enable the production mode. CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:3181:24: Angular is running in the development mode. Call enableProdMode() to enable the production mode. (demoangular) Created Activity ID: 0x22b133, Description: send gesture actions (demoangular) Created Activity ID: 0x22b134, Description: send gesture actions (demoangular) Created Activity ID: 0x22b135, Description: send gesture actions (demoangular) Created Activity ID: 0x22b136, Description: send gesture actions (demoangular) Created Activity ID: 0x22b137, Description: send gesture actions (demoangular) Created Activity ID: 0x22b138, Description: send gesture actions (demoangular) Created Activity ID: 0x22b139, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13a, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13b, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13c, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13d, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13e, Description: send gesture actions (demoangular) Created Activity ID: 0x22b13f, Description: send gesture actions (demoangular) Created Activity ID: 0x22b610, Description: send gesture actions (demoangular) Created Activity ID: 0x22b611, Description: send gesture actions (demoangular) Created Activity ID: 0x22b612, Description: send gesture actions (demoangular) Created Activity ID: 0x22b613, Description: send gesture actions (demoangular) Created Activity ID: 0x22b614, Description: send gesture actions (demoangular) Created Activity ID: 0x22b615, Description: send gesture actions (demoangular) Created Activity ID: 0x22b616, Description: send gesture actions (demoangular) Created Activity ID: 0x22b617, Description: send gesture actions (demoangular) Created Activity ID: 0x22b618, Description: send gesture actions (demoangular) Created Activity ID: 0x22b619, Description: send gesture actions (demoangular) Created Activity ID: 0x22b61a, Description: send gesture actions (demoangular) Created Activity ID: 0x22b61b, Description: send gesture actions

onSwipeCellStarted index: 2 onSwipeCellStarted item: Item 3 CONSOLE LOG file:///app/examples/swipe-actions/listview-swipe-actions.component.js:57:20: >>> onSwipeCellStarted index: 2 CONSOLE LOG file:///app/examples/swipe-actions/listview-swipe-actions.component.js:58:20: >>> onSwipeCellStarted item: Item 3 onItemSelected: Item 3 (demoangular) Created Activity ID: 0x22b6e4, Description: send gesture actions CONSOLE LOG file:///app/examples/swipe-actions/listview-swipe-actions.component.js:79:20: >>> onItemSelected: Item 3 (demoangular) Created Activity ID: 0x22b6e5, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6e6, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6e7, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6e8, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6e9, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6ea, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6eb, Description: send gesture actions (demoangular) Created Activity ID: 0x22b6ec, Description: send gesture actions CONSOLE ERROR [native code]: ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets') ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets') CONSOLE ERROR [native code]: ERROR CONTEXT { "view": { "def": { "nodeFlags": 504741893, "rootNodeFlags": 402653185, "nodeMatchedQueries": 6, "flags": 0, "nodes": [ { "nodeIndex": 0, "parent": null, "renderParent": null, "bindingIndex": 0, "outputIndex": 0, "checkIndex": -1, "flags": 402653184, "childFlags": 0, "directChildFlags": 0, "childMatchedQueries": 0, "ngContentIndex": -1, "matchedQueries": {}, "matchedQueryIds": 0, "references": {}, "childCount": 0, "bindings": [], "bindingFlags": 0, "outputs": [], "element": null, "provider": null, "text": null, "query": { "id": 1, "filterId": 2, "bindings": [ { "propName": "listViewComponent", "bindingType": 0 } (demoangular) Created Activity ID: 0x22b6ed, Description: send gesture actions CONSOLE ERROR [native code]: ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets') ERROR CONTEXT DebugContext_ {view: Object, nodeIndex: 4, nodeDef: Object, elDef: Object, elView: Object, …} ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets') CONSOLE ERROR [native code]: ERROR CONTEXT { "view": { "def": { "nodeFlags": 504741893, "rootNodeFlags": 402653185, "nodeMatchedQueries": 6, "flags": 0, "nodes": [ { "nodeIndex": 0, "parent": null, "renderParent": null, "bindingIndex": 0, "outputIndex": 0, "checkIndex": -1, "flags": 402653184, "childFlags": 0, "directChildFlags": 0, "childMatchedQueries": 0, "ngContentIndex": -1, "matchedQueries": {}, "matchedQueryIds": 0, "references": {}, "childCount": 0, "bindings": [], "bindingFlags": 0, "outputs": [], "element": null, "provider": null, "text": null, "query": { "id": 1, "filterId": 2, "bindings": [ { "propName": "listViewComponent", "bindingType": 0 } (demoangular) Created Activity ID: 0x22b6ee, Description: send gesture actions CONSOLE ERROR [native code]: ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets')

ERROR CONTEXT DebugContext_ {view: Object, nodeIndex: 4, nodeDef: Object, elDef: Object, elView: Object, …} ERROR TypeError: undefined is not an object (evaluating 'item.nameasd.gets') ...

KirilOkun commented 5 years ago

Got the same problem on null object reference.