NativeScript / NativeScript/nativescript-cli
[Bundle workflow] Breakpoint in linked source not hit in VSCode on lightweight app initial load
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 1.1k
- 派生
- 204
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 8
描述
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: rc
- Cross-platform modules: rc
- Android Runtime: rc
Describe the bug
Breakpoint in linked tns-core-modules source is not hit in VSCode on initial app start when using a very thin (lightweight) NativeScript app (e.g. created from blank template) even when stopOnEntry is set to true. After initial load debugging works as expected. A workaround proposed by @DimitarTachev is to place a debugger; statement in the beginning of the file-to-debug.
To Reproduce
git clone git@github.com:NativeScript/NativeScript.gitcd NativeScripttns create bottom-nav-test --template tns-template-blank-tscd bottom-nav-testtns migrate- Open NativeScript folder in VSCode
- Replace the contents of bottom-nav-test/app-root.xml with:
<BottomNavigation>
<TabStrip>
<TabStripItem title="First"></TabStripItem>
<TabStripItem title="Second"></TabStripItem>
</TabStrip>
<TabContentItem>
<GridLayout>
<Label text="First View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Second View" />
</GridLayout>
</TabContentItem>
</BottomNavigation>
- Place a breakpoint in the
OnLoaded()method in tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts - Configure NativeScript debugging and add the following debug configuration in launch.json:
{
"name": "bottom-nav | Launch on Android",
"type": "nativescript",
"request": "launch",
"platform": "android",
"appRoot": "${workspaceRoot}/bottom-nav-test",
"sourceMaps": true,
"stopOnEntry": true,
"watch": true
},
- Try to debug using the newly added configuration
- Breakpoint in
OnLoaded()is not hit
Expected behavior
Breakpoints should work on initial app start as well
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用列出的 NativeScript 命令复现轻量级 Android 应用,然后从 tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts 和 launch.json 中的 stopOnEntry 配置开始。跟踪初始启动和 source-map 调试流程,以确定为什么会跳过 OnLoaded(),并使用 debugger workaround 进行比较。完成的标准是在初始应用加载期间命中 breakpoint,且不添加 debugger;。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, javascript, typescript, vscode
- 领域
- cli, developer-experience, mobile-dev
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100