Open Ptipoi-jf opened 9 months ago
i forget to say my first try is using hot reload with visual studio but did not work, that why i'm trying to use dotnet watch
I've been sitting here on the sidelines not sure if I'm only going to contribute noise...
We've had nearly identical issue show up while working on our client project.
dotnet watch
prints the error: Connecting to the browser is taking longer than expected
endlessly.Unlike the report here... Hot reload had been functioning previously, and then one dev started noticing trouble... and then it "spread" to my machine after some time. It makes me think that something changed in our runtime. Maybe a very subtle change was made to the project (or this is some sort of bug)
It's intriguing to hear that some sample projects seem to work out of the box while others don't.
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.4
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: arm64
Commit: 5535e31a71
.NET SDKs installed:
6.0.412 [/usr/local/share/dotnet/sdk]
6.0.413 [/usr/local/share/dotnet/sdk]
6.0.414 [/usr/local/share/dotnet/sdk]
7.0.306 [/usr/local/share/dotnet/sdk]
7.0.307 [/usr/local/share/dotnet/sdk]
7.0.308 [/usr/local/share/dotnet/sdk]
7.0.401 [/usr/local/share/dotnet/sdk]
8.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
I'll spend some time today to see if I can run all 3 listed sample projects on my Mac, then see if I get the same results.
From there... I wonder if we can isolate it to the installed versions of the dotnet SDK, and the installed workloads.
Indeed: 7.0/BlazorWebAssemblySignalRApp/Server
doesn't hot-reload on my machine out of the box. (no code changes made)
dotnet watch
- Verified the logs: Connecting to the browser is taking longer than expected ...7.0/BlazorWebAssemblySignalRApp/Client/Pages/Index.razor
File changed:
showed up in logsCuriously, the 8.0 signalR demo seemed to function like we expect:
8.0/BlazorSignalRApp
β
Checking the other net7.0 examples
7.0/BlazorWebAssemblyScopesLogger
β
dotnet watch
and restart it to get everything full working, but after cycling it, hot reload worked as expected7.0/BlazorServerEFCoreSample
β
I think this still leaves the workload version, and net7.0-related runtimes as "things to check" (although we don't have any similarities there)
I might take a peak at the different .csproj
's to see if any differences stick out as well.
Nothing jumped out to me as out of line... I decided to take a look at the port numbers on a hunch:
The 7.0/BlazorWebAssemblySignalRApp/Server
opens to 5276
with no hot-reload β
8.0/BlazorSignalRApp uses 7034
β
7.0/BlazorServerEFCoreSample uses 5276
β
<- same as BlazorWebAssemblySignalRApp
So it's not some sort of port conflict... Hot reload can work on 5276... its more project specific than that.
And all of the .csproj
files are all quite thin... I'm not seeing anything jump out to me there... our installed lists of SDK's are different... the only similarities that I can see involce having the latest version of the sdk and workload (workload manifest?) installed...
Perhaps it's something to do with order in program.cs
or something otherwise subtle.
I was finally able to unstick my side of things on a project where hot reload was working but mysteriously broke.
dotnet watch
Connecting to the browser is taking longer than expected
Empty Cache and Hard Reload
I was able to see chatter in console as the browser reconnected.
I decided to try this in our problematic 7.0/BlazorWebAssemblySignalRApp/Server
This didn't fix the issue immediately however @Ptipoi-jf disabled Response Compression in the example... which I haven't yet. In my logs, I still see:
warn: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[4]
Unable to configure browser refresh script injection on the response. This may have been caused by the response's Content-Encoding: 'br'. Consider disabling response compression.
dotnet watch β Connecting to the browser is taking longer than expected ...
dotnet watch β Connecting to the browser is taking longer than expected ...
dotnet watch β Connecting to the browser is taking longer than expected ...
My bet is both things need to happen:
When I comment out response compression, the SignalR demo fails to compile... and other demos that AddResponseCompression(...)
seem to function... so I'm not confident this is it...
Thanks to your multiples tests !
Response Compression
was disabled on my test (see screen diff) but i guess i didn't try to clear cache of my browser (i'm using edge)
i'll try to clear cache like you, i'll give feedback here
Using dotnet.exe, I'm experiencing this in Visual Studio 17.8.6, .Net 8.0.1, which began happening after re-installing Visual Studio due to some Wasm errors I could not explain or get rid of otherwise. Disabling response compression, or even SignalR entirely, does not fix it.
Running as dotnet run (or watch) I cannot connect to my web application in the browser - i get "Connection refused" (even though the application has started). I can, however, run the application from Visual Studio.
@paulguz-datapa You may be experiencing something of a different issue:
The original issue states that the application can be served... but no longer "hot-reloads" with a noteworthy message in the console after running dotnet serve
Connecting to the browser is taking longer than expected
If you're getting a "Connection Refused"... that sounds like something new... (or an addition)
That being said, if you're able to get your application up and open in a browser... I have found that I need to both:
It's not great... The fact that I need to do this every time I dotnet watch
and open a new tab almost defeats the purpose of having hot-reload in the first place...... but it does seem to get things to work for a little bit. Do you think you have another issue at hand?
@CptSpaceToaster Forget the Connection Refused, my app was running on a different port at dotnet.exe, I forgot I had been messing with my ASPNETCORE_URLS environment variable before I had the Wasm trouble.
Have fixed that, but still get Connecting to the browser is taking longer than expected
, Hot Reload seems ok at the moment, however. Will update if that changes.
Is there an existing issue for this?
Describe the bug
Hot reload did not work using
dotnet watch --verbose run
on the sample project7.0/BlazorWebAssemblySignalRApp
from https://github.com/dotnet/blazor-samples.gitdotnet watch seems to not able to connect to the browser :
Connecting to the browser is taking longer than expected...
The only change i made in this repo (testing and recommendation from old bug)![image](https://github.com/dotnet/aspnetcore/assets/9008010/0b569528-0b75-4aa6-b0ed-622a2cde72d4)
dotnet watch logs :
Expected Behavior
I expect hot reload to work like other projects
BlazorWebAssemblyScopesLogger
orBlazorServerEFCoreSample
in the same repo sampleBlazorWebAssemblyScopesLogger
is working with net7 and net8Steps To Reproduce
run
dotnet watch run
over7.0/BlazorWebAssemblySignalRApp/Server
no need to edit something, dotnet watch show continusly the message
Connecting to the browser is taking longer than expected...
Exceptions (if any)
No response
.NET Version
8.0.100
Anything else?
commit hash from sample repo : 0ecc2bc297549b620c74efeb0b42b6ad638982c7
dotnet --info
output : SDKΒ .NETΒ : Version: 8.0.100 Commit: 57efcf1350 Workload version: 8.0.100-manifests.8d38d0ccEnvironnement d'exΓ©cutionΒ : OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100\
Charges de travail .NET installΓ©esΒ : Workload version: 8.0.100-manifests.8d38d0cc Il n'y a aucune charge de travail installΓ©e Γ afficher.
Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71
.NET SDKs installed: 3.0.100-preview7-012821 [C:\Program Files\dotnet\sdk] 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.100 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] 6.0.319 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: arm64 [C:\Program Files\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\arm64\InstallLocation] x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download