NativeScript / NativeScript/nativescript-cli

[Bundle workflow] Breakpoint in linked source not hit in VSCode on lightweight app initial load

Offen
#4,812 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

os: android
Vorherrschende Sprache
JavaScript
Sterne
1.1k
Forks
204
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
8

Beschreibung

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

  1. git clone git@github.com:NativeScript/NativeScript.git
  2. cd NativeScript
  3. tns create bottom-nav-test --template tns-template-blank-ts
  4. cd bottom-nav-test
  5. tns migrate
  6. Open NativeScript folder in VSCode
  7. 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>
  1. Place a breakpoint in the OnLoaded() method in tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts
  2. 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
        },
  1. Try to debug using the newly added configuration
  2. Breakpoint in OnLoaded() is not hit

Expected behavior
Breakpoints should work on initial app start as well

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die schlanke Android-App mit den aufgeführten NativeScript-Befehlen und beginne dann mit tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts und der stopOnEntry-Konfiguration in launch.json. Verfolge den anfänglichen Start- und Source-Map-Debugging-Ablauf zurück, um festzustellen, warum OnLoaded() übersprungen wird, und verwende die Debugger-Umgehung als Vergleich. Als erledigt gilt die Aufgabe, wenn der Breakpoint während des anfänglichen Ladens der App getroffen wird, ohne debugger; hinzuzufügen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, javascript, typescript, vscode
Bereich
cli, developer-experience, mobile-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.