nativescript-community/nativescript-vscode-extension

Launch on iOS - iOS debugger disconnects after ~10 seconds for no apparent reason

adrian-niculescu opened this issue · 4 comments

Environment

  • CLI: 8.6.5
  • Android Runtime: 8.6.2
  • iOS Runtime: 8.6.3
  • VSCode: 1.86.2
  • NativeScript VSCode extension: 0.12.3

Result of echo 'y' | npx nativescript-envinfo

OS: macOS 14.3.1
CPU: (12) arm64 Apple M2 Pro
Shell: /bin/bash
node: 20.11.1
npm: 10.3.0
nativescript: 8.6.5

# android
java: 17.0.7
ndk: Not Found
apis: 32, 33, 34
build_tools: 33.0.0, 33.0.1, 34.0.0
system_images: 
  - android-28 | Google ARM64-V8a Play ARM 64 v8a
  - android-29 | Google Play ARM 64 v8a
  - android-30 | Google APIs ARM 64 v8a
  - android-30 | Google Play ARM 64 v8a
  - android-33 | Google APIs ARM 64 v8a
  - android-33 | Google Play ARM 64 v8a
  - android-34-ext8 | Google Play ARM 64 v8a
  - android-34 | Google APIs ARM 64 v8a
  - android-34 | Google Play ARM 64 v8a

# ios
xcode: 15.2/15C500b
cocoapods: 1.15.2
python: 3.11.7
python3: 3.11.7
ruby: 3.3.0
platforms: 
  - DriverKit 23.2
  - iOS 17.2
  - macOS 14.2
  - tvOS 17.2
  - visionOS 1.0
  - watchOS 10.2

Dependencies

"dependencies": {
  "@nativescript/core": "~8.6.2",
  "@nativescript/theme": "~3.0.2"
},
"devDependencies": {
  "@nativescript/android": "8.6.2",
  "@nativescript/ios": "8.6.3",
  "@nativescript/types": "~8.6.1",
  "@nativescript/webpack": "~5.0.18",
  "typescript": "~5.2.0"
}

Describe the bug

I let the NativeScript extension create the .vscode/launch.json file. Run the Launch on iOS configuration . It runs the app successfully, but then it disconnects automatically after ~ 10 seconds for no apparent reason. This replicates with both real devices (iPhone 12, iOS 16.1) and iOS Simulators (iOS 16.4, iOS 17.2). This does not replicate on Android.

To Reproduce

Create a simple NativeScript with the CLI

ns create testApp --ts
cd testApp
npm install
ns platform add ios
ns platform update ios

Open the app in Visual Studio Code. Go to Run and Debug. Let the NativeScript extension create the .vscode/launch.json file. Run the Launch on iOS configuration.

Expected behavior

The debugger should not disconnect after ~ 10 seconds.

Sample project

Sample project

Additional context

The OUTPUT window:

[NSDebugAdapter] Using tns CLI on path 'tns'

[NSDebugAdapter] Running tns command...

[NSDebugAdapter] Using iOS Team ID 'REDACTED', you can change this in the workspace settings.

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

Searching for devices...

Preparing project...

webpack is watching the files...

asset �[1m�[32mvendor.js�[39m�[22m 6.92 MiB �[1m�[33m[compared for emit]�[39m�[22m (name: vendor) (id hint: defaultVendor)
asset �[1m�[32mbundle.js�[39m�[22m 339 KiB �[1m�[33m[compared for emit]�[39m�[22m (name: bundle)
asset �[1m�[32mruntime.js�[39m�[22m 86.2 KiB �[1m�[33m[compared for emit]�[39m�[22m (name: runtime)
asset �[1m�[32mtns_modules/inspector_modules.js�[39m�[22m 1.22 KiB �[1m�[33m[compared for emit]�[39m�[22m (name: tns_modules/inspector_modules)
Entrypoint �[1mbundle�[39m�[22m 7.33 MiB = �[1m�[32mruntime.js�[39m�[22m 86.2 KiB �[1m�[32mvendor.js�[39m�[22m 6.92 MiB �[1m�[32mbundle.js�[39m�[22m 339 KiB
Entrypoint �[1mtns_modules/inspector_modules�[39m�[22m 7 MiB = �[1m�[32mruntime.js�[39m�[22m 86.2 KiB �[1m�[32mvendor.js�[39m�[22m 6.92 MiB �[1m�[32mtns_modules/inspector_modules.js�[39m�[22m 1.22 KiB
runtime modules 24.8 KiB 11 modules
orphan modules 13.5 KiB �[1m�[33m[orphan]�[39m�[22m 9 modules
modules by path �[1m./node_modules/@nativescript/�[39m�[22m 1.68 MiB 195 modules
modules by path �[1m./node_modules/css-tree/�[39m�[22m 317 KiB 113 modules
modules by path �[1m./app/�[39m�[22m 124 KiB 7 modules
modules by path �[1m./node_modules/source-map/lib/*.js�[39m�[22m 36.3 KiB 6 modules
modules by path �[1m./node_modules/reduce-css-calc/dist/�[39m�[22m 131 KiB 5 modules
modules by path �[1m./node_modules/postcss-value-parser/lib/*.js�[39m�[22m 12.5 KiB
  �[1m./node_modules/postcss-value-parser/lib/index.js�[39m�[22m 607 bytes �[1m�[33m[built]�[39m�[22m �[1m�[33m[code generated]�[39m�[22m
  + 4 modules
modules by path �[1m./node_modules/mdn-data/css/*.json�[39m�[22m 242 KiB
  �[1m./node_modules/mdn-data/css/at-rules.json�[39m�[22m 11.6 KiB �[1m�[33m[built]�[39m�[22m �[1m�[33m[code generated]�[39m�[22m
  + 2 modules
+ 5 modules
webpack 5.90.2 compiled �[1m�[32msuccessfully�[39m�[22m in 1151 ms
Webpack compilation complete. Watching for file changes.

Updating runtime package.json with configuration values...

Project successfully prepared (ios)

File change detected. Starting incremental webpack compilation...

Type-checking in progress...

assets by status 7.34 MiB �[1m�[32m[cached]�[39m�[22m 4 assets
Entrypoint �[1mbundle�[39m�[22m 7.33 MiB = �[1m�[32mruntime.js�[39m�[22m 86.2 KiB �[1m�[32mvendor.js�[39m�[22m 6.92 MiB �[1m�[32mbundle.js�[39m�[22m 339 KiB
Entrypoint �[1mtns_modules/inspector_modules�[39m�[22m 7 MiB = �[1m�[32mruntime.js�[39m�[22m 86.2 KiB �[1m�[32mvendor.js�[39m�[22m 6.92 MiB �[1m�[32mtns_modules/inspector_modules.js�[39m�[22m 1.22 KiB
cached modules 2.78 MiB (javascript) 24.8 KiB (runtime) �[1m�[32m[cached]�[39m�[22m 358 modules
�[1m./app/ sync \.(xml%7Cjs%7C(?<%21\.d\.)ts%7Cs?css)$�[39m�[22m 270 bytes �[1m�[33m[built]�[39m�[22m
webpack 5.90.2 compiled �[1m�[32msuccessfully�[39m�[22m in 53 ms

Webpack compilation complete. Watching for file changes.

Type-checking in progress...

No errors found.

Successfully transferred bundle.js on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.
Successfully transferred package.json on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.

Successfully transferred runtime.js on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.
Successfully transferred tns_modules on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.

Successfully transferred inspector_modules.js on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.

Successfully transferred vendor.js on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.

Restarting application on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE...

  [HMR][cd3ccbf9ba034b589abe] boot | HMR Enabled - waiting for changes...

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

'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.


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


Opened localhost 41000

To start debugging, open the following URL in Chrome:
devtools://devtools/bundled/inspector.html?ws=localhost:41000

Successfully synced application org.nativescript.testApp on device BBE3F6C9-BDDA-42EC-AB9F-EE7D67E1AEBE.

[NSDebugAdapter] Ready to attach to application on 41000

The DEBUG CONSOLE window:

Error when trying to require webpack.config.js file from path '/Users/adriann/Developer/SANDBOX/testApp/webpack.config.js'. Error is: Error: Cannot find module '/package.json'
Require stack:
- /Users/adriann/Developer/SANDBOX/testApp/node_modules/@nativescript/webpack/dist/helpers/project.js
- /Users/adriann/Developer/SANDBOX/testApp/node_modules/@nativescript/webpack/dist/helpers/dependencies.js
- /Users/adriann/Developer/SANDBOX/testApp/node_modules/@nativescript/webpack/dist/helpers/externalConfigs.js
- /Users/adriann/Developer/SANDBOX/testApp/node_modules/@nativescript/webpack/dist/index.js
- /Users/adriann/Developer/SANDBOX/testApp/webpack.config.js
- /Users/adriann/.vscode/extensions/nativescript.nativescript-0.12.3/out/debug-adapter/nativeScriptDebugAdapter.js
- /Users/adriann/.vscode/extensions/nativescript.nativescript-0.12.3/out/debug-adapter/nativeScriptDebug.js
- /[eval]

Note that this error pops up when using Launch on Android too, but the debugger does NOT disconnect there.

Thanks @adrian-niculescu , this is a known issue that we will resolve in the next release, I hope it will be this week. @rigor789 @farfromrefug , do we have any progress to be able to publish the version?