You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: 5.1.0
Cross-platform modules: 5.1.0
Android Runtime: 5.1.0
iOS Runtime: Not applicable
Plugin(s): Not applicable
Describe the bug
When debugging on Android, if you've stopped on a breakpoint and apply a change in .xml/.css/.html file, the change will be synced, but CLI will stuck on Sync operation in progress... for a while and after that an error will be shown: Unable to apply changes for device: <device id>. Error is: Sync operation is taking too long.
To Reproduce
tns create myApp --js
cd myApp
tns debug android
When CLI prints a Chrome URL, open it in the browser.
Place a breakpoint on line 17 of main-view-model.js (inside the onTap method: this.counter--;)
Tap the button on the Android device - Chrome DevTools should stop on the breakpoint.
While you've stopped on the breakpoint, open your project in VSCode.
Open main-page.xml in VSCode and change the title of the ActionBar from:
Now check your terminal. CLI will print the following messages:
Executing before-shouldPrepare hook from <path to hook>
Preparing project...
Executing before-prepareJSApp hook from <path to hook>
Project successfully prepared (Android)
Executing after-prepare hook from <path to hook>
Successfully transferred main-page.xml on device <device id>.
Sync operation in progress...
Sync operation in progress...
Sync operation in progress...
Sync operation in progress...
Sync operation in progress...
Unable to apply changes for device: <device id>. Error is: Sync operation is taking too long.
Executing after-watch hook from <path to hook>
Stopping webpack watch
Expected behavior
CLI should sync the change and allow you to continue debugging.
Additional context
Issue is not reproducible in case you've not stopped on breakpoint.
The text was updated successfully, but these errors were encountered:
The reason for that behavior is the order of operations that is executed in the Android Runtime.
When a doSync operation is send to the device it first executes a script that refreshes the application and then sends back a notification that the operation is completed. If a doSync is received, while the application is blocked by a breakpoint the thread will be blocked until the script is evaluated(hit continue of the breakpoint) and this causes a timeout on the CLI side.
We have two options to solve that, but none seems very acceptable:
1 Reorder operations - first send a notification that the application is synced and then run the script.
2 In case we are in debug scenario we can disable the operation timeout.
The first option seems wrong as we will be able to continue with next sync while the application is refreshing (we might call the refresh script while the TNS modules are still in invalid state), which will probably result in a crash or a least an unpredictable behavior.
If we use the second option, every next livesync action will be queued on the chain, but will await the first one that will finish once the breakpoint is released. Then there will be a few consecutive refreshes and potentially a few restarts of the application. (haven't tested it, but pretty sure this will happen).
Environment
Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug
When debugging on Android, if you've stopped on a breakpoint and apply a change in
.xml
/.css
/.html
file, the change will be synced, but CLI will stuck onSync operation in progress...
for a while and after that an error will be shown:Unable to apply changes for device: <device id>. Error is: Sync operation is taking too long.
To Reproduce
tns create myApp --js
cd myApp
tns debug android
main-view-model.js
(inside theonTap
method:this.counter--;
)main-page.xml
in VSCode and change the title of theActionBar
from:to
Expected behavior
CLI should sync the change and allow you to continue debugging.
Additional context
Issue is not reproducible in case you've not stopped on breakpoint.
The text was updated successfully, but these errors were encountered: