microsoft / microsoft/aspire

[AspireE2E][Aspire CLI]An unexpected error occurred: The JSON-RPC connection with the remote party was lost before the request could complete when dotnet watch on Aspire AppHost project

Open
#13,929 5 comments 1 reaction 0 assignees View on GitHub
area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

**INSTALL STEPS**

1. Clean machine: Win11 x64 23h2 ENU
2. Install SDK 10.0.102
3. Install Aspire.Cli 13.1.0 `iex "& { $(irm https://aspire.dev/install.ps1) }"`
4. Enable the hot reload feature in aspire CLI with `aspire config set features.defaultWatchEnabled true`

**REPRO STEPS**
1. Open CMD and create an Aspire Starter App (ASP.NET Core/Blazor)
```
dotnet new aspire-starter -o aspire01
cd aspire01/aspire01.AppHost
```
1. Run `aspire run`
1. Open the URL on browser.
1. Open AppHost.cs file under xxx.AppHost, and add code `.WithReplicas(2);` then save the file.
Image

**ACTUAL**
The process is shut down and An unexpected error occurred: The JSON-RPC connection with the remote party was lost before the request could complete.
Image

**Note**:
1. This issue does not reproduce on Web project and ApiService project

**ERROR LOG**
```cmd
❌ An unexpected error occurred: The JSON-RPC connection with the remote party was lost before the request
could complete.
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building C:\Users\v-zhajin\Aspire2\Aspire2.Apphost\Aspire2.AppHost.csproj ...
dotnet watch 🔨 Build succeeded: C:\Users\v-zhajin\Aspire2\Aspire2.Apphost\Aspire2.AppHost.csproj
Using launch settings from C:\Users\v-zhajin\Aspire2\Aspire2.Apphost\Properties\launchSettings.json...
info: Aspire.Hosting.DistributedApplication[[0]]
Aspire version: 13.2.0-preview.1.26064.8+12d27ad489e97bcfa37c074f3fa310643c8dc7f7
info: Aspire.Hosting.DistributedApplication[[0]]
Distributed application starting.
info: Aspire.Hosting.DistributedApplication[[0]]
Application host directory is: C:\Users\v-zhajin\Aspire2\Aspire2.Apphost
info: Aspire.Hosting.DistributedApplication[[0]]
Now listening on: https://localhost:17017
info: Aspire.Hosting.DistributedApplication[[0]]
Login to the dashboard at https://localhost:17017/login?t=2aac32108ba777016e1172b8cca5c35e
info: Aspire.Hosting.DistributedApplication[[0]]
Distributed application started. Press Ctrl+C to shut down.
dotnet watch ⌚ File updated: .\AppHost.cs
dotnet watch 🔥 Restart is needed to apply the changes.
dotnet watch ⌚ [[Aspire2.ApiService (net10.0)]] Exited
dotnet watch ⌚ [[Aspire2.Web (net10.0)]] Exited
```
**EXPECTED**
The hot reload should be successfully or restart the app automatically.

Image

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the listed SDK, Aspire CLI configuration, starter app commands, and the AppHost.cs edit. Start by comparing the dotnet watch output around the AppHost restart and JSON-RPC disconnect with the note that Web and ApiService projects do not reproduce it. Done means saving the AppHost change no longer loses the connection and the app hot-reloads or restarts automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.