dotnet / dotnet/sdk

dotnet watch Blazor Hot Reload WebSocket connection fails on custom TLD in SDK 10.0.401

Open
#56,291 2 comments 1 reaction 1 assignee Claimed by @tmat View on GitHub
Area-Watch
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

There is a regression introduced in .NET SDK `10.0.401` where Hot Reload completely stops working if the application is accessed via a custom subdomain structure ending in `.dev.localhost` (e.g., `http://app.dev.localhost:xxxx`) instead of the standard naked `localhost`.

The browser console throws a WebSocket connection error when the page loads.
Reverting the environment back to SDK `10.0.400` resolves the problem completely without any code or configuration changes, allowing the WebSocket to connect normally.

### Expected Behavior

_No response_

### Steps To Reproduce

1. Create a new Blazor Web App:
```bash
dotnet new blazor -o BlazorBugRepro
cd BlazorBugRepro
```

2. Run the application using custom TLD address:
```bash
dotnet watch run --urls "http://bug.dev.localhost:5000"
```

3. Navigate to the app in the browser and open Developer Tools (F12) Console.
4. **Result:** A WebSocket connection error to the hot reload server is thrown.
5. Change the local version to `10.0.400` in `global.json` and repeat. The WebSocket connects successfully.

### Exceptions (if any)

_No response_

### .NET Version

10.0.401

### Anything else?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.