-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
Running dotnet watch run --no-hot-reload does not work correctly, at least for blazor-wasm projects.
When a rebuild is triggered, it does not shut down the old dev server, causing the new one to fail with a bind error.
To Reproduce
- Create new blazor wasm app (ie.
dotnet new blazorwasm -e -p --no-https) - Run with watch:
dotnet watch run -c Release --property WarningLevel=0 --no-hot-reload - Open in browser
- Make a change to one of the .razor files (ie. Home.razor)
- Note that the server fails to start
- Reload the page, note that the browser console is spammed with integrity errors due to not being able to find files.
Exceptions (if any)
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
Hosting failed to start
System.IO.IOException: Failed to bind to address http://[::]:5117: address already in use.
---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
---> System.Net.Sockets.SocketException (98): Address already in use
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
Further technical details
details of dotnet --info
``` .NET SDK: Version: 10.0.100-rc.2.25502.107 Commit: 89c8f6a112 Workload version: 10.0.100-manifests.0cee6f9c MSBuild version: 18.0.0-preview-25502-107+89c8f6a11
Runtime Environment:
OS Name: nixos
OS Version: 25.11
OS Platform: Linux
RID: linux-x64
Base Path: /nix/store/aj7lxjjn3rl2bazsv9p0dfnv069j6rsq-dotnet-sdk-10.0.100-rc.2.25502.107/share/dotnet/sdk/10.0.100-rc.2.25502.107/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0-rc.2.25502.107
Architecture: x64
Commit: 89c8f6a112
.NET SDKs installed:
10.0.100-rc.2.25502.107 [/nix/store/aj7lxjjn3rl2bazsv9p0dfnv069j6rsq-dotnet-sdk-10.0.100-rc.2.25502.107/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.0-rc.2.25502.107 [/nix/store/aj7lxjjn3rl2bazsv9p0dfnv069j6rsq-dotnet-sdk-10.0.100-rc.2.25502.107/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.0-rc.2.25502.107 [/nix/store/aj7lxjjn3rl2bazsv9p0dfnv069j6rsq-dotnet-sdk-10.0.100-rc.2.25502.107/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [1]
DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER [1]
global.json file:
Invalid [/home/Rory/git/matrix/MatrixUtils-master/global.json]
Version '9.0.0' is not valid for the 'sdk/version' value. SDK feature bands start at 1 - for example, 9.0.100
</p>
</details>
- Rider 2025.2.4 on NixOS, though using dotnet CLI to run my project.