Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote control connection error in VSCode #19226

Closed
nickrandolph opened this issue Jan 14, 2025 · 13 comments
Closed

Remote control connection error in VSCode #19226

nickrandolph opened this issue Jan 14, 2025 · 13 comments
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@nickrandolph
Copy link
Contributor

Current behavior

Created new app from cli "dotnet new unoapp -preset blank -o TestApp"
Opened folder in VSCode
Selected Android + Emulator and then "Run without debugger"

Image
Connection isn't established correctly

Changes in XAML aren't being correctly sent to device
Image

uno.templates version: 5.6.2
uno.check version: 1.28.0-dev.43

Generated ServerEndpoint includes localhost, which might be an issue for connection??
Image

Expected behavior

HR connection status should show green
XAML changes should be sent to device

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@nickrandolph nickrandolph added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 14, 2025
@dr1rrb
Copy link
Member

dr1rrb commented Jan 14, 2025

@spouliot @jeromelaban

@spouliot
Copy link
Contributor

Cannot initialize without debugger attached

Does anyone know why is this displayed in the events ?

It is, as best, confusing since with VS Code you can only do hot reload if the debugger is not used. From Nick's

and then "Run without debugger"

that seems to be correct but if there's logic behind the error message then it might be blocking the only way it can work right now.

@dr1rrb
Copy link
Member

dr1rrb commented Jan 15, 2025

Does anyone know why is this displayed in the events ?

Because on VS we now need to have the debugger attached to get the HR. I'll confirm all those messages before the release (things can still evolve in term of support).

But @spouliot the main point I observe with Nick is that the port number and / or host is not configured properly, so the client is not even able to connect back to the dev-server.

@dr1rrb
Copy link
Member

dr1rrb commented Jan 15, 2025

To clarify, we had to git clean -fdx to get this [ServerEndpoint("http://localhost:54731", 0], all previous build (and rebuild) was providing a wrong port number ... but in the format [ServerEndpoint("192.168.1.1", 1234] which make me think it could be linked to the fact the solution has been opened in VS once?! Not sure which config should have been pushed by code? locahost sounds wrong while being in an android emulator ...

But @nickrandolph something bugs me however, how did you get the second screenshot with the "No changes detected" ? Because this could indeed being caused by a wrong condition in HR startup.

@spouliot
Copy link
Contributor

@dr1rrb Since this PR the extension provides a <UnoRemoteControlPort>XXX</UnoRemoteControlPort> inside the .csproj.user file that should be used (to connect back) instead of relying on the RemoteControlHost.config file (and should be identical to what was done for Rider).

@dr1rrb
Copy link
Member

dr1rrb commented Jan 15, 2025

@dr1rrb Since this PR the extension provides a <UnoRemoteControlPort>XXX</UnoRemoteControlPort> inside the .csproj.user file that should be used (to connect back) instead of relying on the RemoteControlHost.config file (and should be identical to what was done for Rider).

Oh ok good to know. So either there is a bug there, either is it possible that if the file is still on the disk it still being considered?

@nickrandolph
Copy link
Contributor Author

Quick summary of more detailed repro steps:

  • createa app using wizard in VS
  • run app on android within VS - this works, and includes a large number of different ServerEndpoint attributes
  • close VS and open same app in VS code
  • attempt to run without debugger - remote control server starts with a different port to the one used by VS but the app doesn't get rebuilt, so incorrect port number
  • In SolutionExplorer - force rebuild of the app - this creates new ServerEndpoint attributes all with port set to 0
  • Delete bin/obj folders, and run without debugger - the app now has the correct port number in the ServerEndpoint attribute.
  • eg [assembly: ServerEndpoint("http://localhost:52340/", 0)]
  • However, server connection fails and looking in the Uno Platofrm -Hot Reload log in VS Code I see "Remote control process exited with 1 and signal null"
  • Restarted VS code and run without debugger - app still isn't connecting properly

@spouliot
Copy link
Contributor

attempt to run without debugger

Did you select an active project ? or was the solution selected ?

See @agneszitte reply for a similar issue.

but the app doesn't get rebuilt

It's weird that it is not rebuilt... the .csproj.user file is different and that should have triggered a build (nothing to do with the extension). I'll try to duplicate this.

@nickrandolph
Copy link
Contributor Author

nickrandolph commented Jan 16, 2025

Yes project was selected as active project. @spouliot you can ping me directly if you need more info or want to dig into this together

@dr1rrb dr1rrb self-assigned this Jan 16, 2025
@dr1rrb
Copy link
Member

dr1rrb commented Jan 16, 2025

Ok I'm able to somehow repro your issues. Those are linked to the changes introduced by https://github.com/unoplatform/uno.vscode/pull/883 (and the fact the old file remains on the disk is still being considered). Working to fix this.

@Darsh0307
Copy link
Contributor

@nickrandolph @agneszitte

This issue seems to be solved in Android when running without debugger. I am easily able to connect. And the Hot Reload functionality is also working with 5.6.13

Image

@spouliot
Copy link
Contributor

@Darsh0307 with the "Sign in / Register" banner visible that screenshot looks like VS, not VS Code (as mentioned in the issue's title).

@Darsh0307
Copy link
Contributor

Darsh0307 commented Jan 27, 2025

@nickrandolph @spouliot

This issue seems to be solved in Android when running without debugger for VS code with Uno sdk as 5.6.17
This issue was tested on .net9.0-android

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

5 participants