microsoft / vscode-cordova

A Visual Studio Code extension providing intellisense, debug, and build support for Cordova and Ionic projects.
https://marketplace.visualstudio.com/items?itemName=vsmobile.cordova-tools
Other
292 stars 67 forks source link

v2.6.6 can't launch browser #929

Closed bonjourjoel closed 7 months ago

bonjourjoel commented 7 months ago

Hi, it's me again.

Actual Behavior

  1. The extension is broken in update v2.6.6
  2. This is a simple reproducer, which is the strict minimum one would expect from the extension:
    • $> cordova create test
    • $> cd test
    • $> cordova platform add browser
    • $> code .
    • go to the debug tab, and add a launch.json, with Run Browser
    • launch the app
    • BUG --> It is not ready

Expected Behavior

  1. App ready

Hint 1

The window with the remote controls is not opening, as it was before. Not that i need it, because it annoys me more than not. But it might be related to this issue.

Hint 2

vscode-debugadapter-7f366dbd.json.gz

Impossible to downgrade

Also i want to add that i can't revert the update. I tried to downgrade the extension, but the bug remains. Once i have made the update, it's impossible to use the extension again, even with an older version. I have also tried to copy the old .vscode/simulate files from an archive before the update, but it doesn't work.

Software versions

Outputs (Include if relevant)

seamlink-aalves commented 7 months ago

I have the exact same problem with the latest version.

I've done further tests since my last comment and was able to identify that it has something to do with cordova-simulate dependency which was also updated yesterday. I updated the version in package.json from ^1.1.3 (which updates to the latest minor version available 1.2.1) to 1.1.6 and was able to run the debug session in the browser.

EzioLi01 commented 7 months ago

Thanks @bonjourjoel , @seamlink-aalves , it should related to some updates on cordova-simulate, will investigate on this with priority, any updates will comment here. Thanks!

EzioLi01 commented 7 months ago

Update: The issue related to new run argument showbrowser in cordova-simulate, it's not handling cordova-tools passed argument correctly. We will fix this issue on cordova-simulate tomorrow and release new version soon. For the temporary workaround, please try below steps:

  1. Install cordova-tools and run browser debug to install cordova-simulate
  2. Navigate to C:\Users\xxx\.vscode\extensions\msjsdiag.cordova-tools-2.6.6\node_modules\cordova-simulate\src\browsers\browser.js
  3. Add showBrowser = true; at line 20, the new code should be
    let showBrowser = opts.showBrowser;
    showBrowser = true;
    if (!showBrowser) {
        return;
    }
  4. Debug app

Please try this and let me know if this workaround is working. Thanks!

bonjourjoel commented 7 months ago

@EzioLi01 Thank you for your response I have tested the workaround you proposed and I can tell you that it does not work correctly: It does make the app ready alright, but it sends the event ready twice, which is not correct.

EzioLi01 commented 7 months ago

@EzioLi01 Thank you for your response I have tested the workaround you proposed and I can tell you that it does not work correctly: It does make the app ready alright, but it sends the event ready twice, which is not correct.

Thanks for the details, I have tried on my local, but no luck to repro it. I think it should be the separate issue that not related to cordova-simulate changes, I will fix browser launching issue firstly.

I will investigate on this and try to repro it again. Will create a new issue to track it if it's need to fix. Thank you!

https://github.com/microsoft/vscode-cordova/assets/19662219/f39e61ca-d220-4db6-b63c-ff78165cf2c2

bonjourjoel commented 7 months ago

@EzioLi01 Ok, i understand. I will add a line in my code to ignore the second event.

Also i attach a trace of the double event bug. This is on the simple example with cordova create test / cordova platform add browser. My machine is windows 10 home Version 22H2 OsBuild 19045.3516 and i have the latest everything installed.

vscode-debugadapter-ddb8f6bb.json.gz

Oh and also it does not happen on my real project. Only on the reproducer. Weird...

EzioLi01 commented 7 months ago

Thank you for the trace, will keep an eye on this in the future.

EzioLi01 commented 7 months ago

Update: I will start our release process for the cordova-simulate, it should be working fine in next week for cordova-simulate v1.2.2. Will close this issue when related scenario working well in extension.

EzioLi01 commented 7 months ago

Hey guys, cordova-simulate 1.2.2 is released, I have checked this issue is no longer existing. Please update your cordova-simulate version to 1.2.2 to fix it. Close this issue, please let me know if you're still facing this.