reactorui-maui
reactorui-maui copied to clipboard
No Connection to Hot-Reload Server (Port: 45820)
Describe the bug When I use "dotnet-maui-reactor -f net8.0-android" and make changes to the code, I get an error message that I cannot connect to port 45820. Changes are therefore not applied.
To Reproduce Steps to reproduce the behavior: 0. open PowerShell
- dotnet new install Reactor.Maui.TemplatePack
- dotnet tool install -g Reactor.Maui.HotReload
- dotnet new maui-reactor-startup -o maurec1
- cd .\maurec1\
- command "code ."
- open VSCode (also tried with Visual Studio 2022)
- execute the command: "dotnet build -t:Run -f net8.0-android"
- the app is created and successfully opened in the Android Simulator
- open another CMD shell and enter: "dotnet-maui-reactor -f net8.0-android"
- the following error message appears when I make changes to the code: """ Detected changes to 'Pages\MainPage.cs' Replacing syntax tree for: Pages\MainPage.cs Connection to the hot reload server (port: 45820)...Hot reload of the application not possible: System.Net.Sockets.SocketException (10061): A connection could not be established because the target computer rejected the connection. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Sockets.TcpClient.CompleteConnectAsync(ValueTask task) at MauiReactor.HotReloadConsole.HotReloadClient.SendAssemblyFileToServer(MemoryStream stream, MemoryStream pdbStream, CancellationToken cancellationToken) in D:\a\reactorui-maui\reactorui-maui\src\MauiReactor.HotReloadConsole\HotReloadClient.cs:line 297 at MauiReactor.HotReloadConsole.HotReloadClient.ConnectionLoop(CancellationToken cancellationToken) in D:\a\reactorui-maui\reactorui-maui\src\MauiReactor.HotReloadConsole\HotReloadClient.cs:line 154 """
Expected behavior I had expected changes in the code to be applied without an error message
Additional I wonder what "D:\a\reactorui-maui\reactorui-maui\src\MauiReactor.HotReloadConsole\HotReloadClient.cs:line 297" is for a path in the error message. "D:\a" does not exist on my local machine.
Desktop (please complete the following information):
- OS: Windows
- Version: 11
Smartphone (please complete the following information):
- Device: Android Simulator - Pixel_3a_API_34_extension_level_7_x86_64
- Version : Android 14
Hi, MauiReactor hot reload is based on adb, can you execute the command "adb" in a shell and see what it returns? in case it says that it can't find the command you have to install it.
https://stackoverflow.com/questions/35854238/where-is-adb-exe-in-windows-10-located
https://developer-docs.magicleap.cloud/docs/guides/developer-tools/android-debug-bridge/adb-setup/#:~:text=Check%20for%20Existing%20ADB%20Installations,that%20lists%20your%20operating%20system.
https://www.xda-developers.com/install-adb-windows-macos-linux/
嗨,MauiReactor 热重载是基于 adb 的,你能在 shell 中执行命令“adb”看看它返回什么吗?如果它说它找不到命令,你必须安装它。
https://stackoverflow.com/questions/35854238/where-is-adb-exe-in-windows-10-located
https://developer-docs.magicleap.cloud/docs/guides/developer-tools/android-debug-bridge/adb-setup/#:~:text=Check%20for%20Existing%20ADB%20Installations,that%20lists%20your%20operating%20system。
https://www.xda-developers.com/install-adb-windows-macos-linux/
@adospace Hi, can it be used in production environment? I've been watching. I haven't used it yet.
Hi, MauiReactor hot reload is based on adb, can you execute the command "adb" in a shell and see what it returns? in case it says that it can't find the command you have to install it.
https://stackoverflow.com/questions/35854238/where-is-adb-exe-in-windows-10-located
https://developer-docs.magicleap.cloud/docs/guides/developer-tools/android-debug-bridge/adb-setup/#:~:text=Check%20for%20Existing%20ADB%20Installations,that%20lists%20your%20operating%20system.
https://www.xda-developers.com/install-adb-windows-macos-linux/
I could not run the command "adb" in shell - "ABD could not be found"
So, i followed the instructions on the Stackoverflow-Link you gave me: 1a. Go to: C:\Users[user]\AppData\Local\Android\sdk\platform-tools 1b. Or Copy: %LOCALAPPDATA%\Android\sdk\platform-tools 2. Open "environment variables"-window 3. Copy the ADB-Path to Path 4. Check CMD-Shell with "adb" - it worked. 5. Started Android Emulation 6. Open VS-Code 7. Terminal: dotnet build -t:Run -f net8.0-android [success] 8. On a second Terminal: dotnet-maui-reactor -f net8.0-android
Unfortunately, the same error message still appears when changes are made to the code
Is there anything specific I need to consider about port: 45820?
Is it possible that certain ports have to be released for the Android simulation? I've never had to do that before. The error message says: Access was denied.
I have also tried a fresh Android installation.
- Developer options activated
- USB/WiFi debugging activated
- Command executed: "adb devices" -- On the Android device, I was asked for a new connection, which I confirmed.
- I also tried "abd kill-server" on the advice of STackOverflow Posts.
Unfortunately no success so far.
- "adb devices" also somtimes returns....
and sometimes only this:
I dont have any problems debugging/hot reloading "normal" MAUI apps.
By the way, what does this section actually mean? Where does the path come from?
Under Visual-Studio 2022 (on the latest version) I get the following feedback when starting the program
Thank you for your time! :)
Hum, I think that the problem is definitively related to adb. Let's check a few things:
- the application should be executed in Debug mode (I think you already did it)
- Ensure that EnableMauiReactorHotReload() is called in your program.cs (I think you already have it)
- Ensure that you have only one emulator/device running (i.e. if the device is attached, close the emulator and vice-versa)
- The waiting for debugger message is normal and not related to MauiReactor (you should see the same with any other .NET MAUI app)
- Ensure you have the platform-tools installed, the adb used by MauiReactor hot-reload must be in this folder:
C:\Program Files (x86)\Android\android-sdk\platform-tools
Platform tools can be installed also from google: https://developer.android.com/tools/releases/platform-tools
or installing Android Studio
hope it helps, let me know
@MoDao1990217 sorry not sure I correctly understand what you mean, yes MauiReactor can be used in a production environment
@itschnie any news?
@itschnie any news?
sorry for the late reply, i've been struggling a bit with illness and work.
I have downloaded the files and placed them in the folder you suggested (C:\Program Files (x86)\Android\android-sdk\platform-tools).
Unfortunately, the error persists.
Android Studio is already installed.
At least the hot reload works with the Windows-App. So I can work there properly :)
Update: Maybe i solved the "Connection Problem".
I've tried:
Open Console adb kill-server adb start-server dotnet build -t:Run -f net8.0-android dotnet-maui-reactor -f net8.0-android
That was the sequence I used. I will try it again later and hope it was the solution to the problem.
yes messages are correct, seems working