NativeScript / NativeScript/nativescript-cli
[Bundle workflow] Breakpoint in linked source not hit in VSCode on lightweight app initial load
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 204
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 8
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện ứng dụng Android nhẹ bằng các lệnh NativeScript được liệt kê, sau đó bắt đầu với tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts và cấu hình stopOnEntry trong launch.json. Theo dõi luồng khởi động ban đầu và gỡ lỗi source-map để xác định lý do OnLoaded() bị bỏ qua, sử dụng cách khắc phục bằng debugger để đối chiếu. Được xem là hoàn tất khi breakpoint được kích hoạt trong quá trình tải ứng dụng ban đầu mà không thêm debugger;.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, javascript, typescript, vscode
- Lĩnh vực
- cli, developer-experience, mobile-dev
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100