microsoft / microsoft/aspire

Error when launchSettings.json is missing

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

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Aspire version: 13.3.0-preview.1.26169.7

Running `aspire run --debug` results in an error. I reported this initially on Discord at https://discord.com/channels/1361488941836140614/1484668783816609913/1484668783816609913 and @davidfowl helped me get it working again.

It turned out that I had a gitignore rule that inadvertently excluded the launchSettings.json file for the AppHost so it was missing on my new computer.

### Expected Behavior

`aspire run` detects the missing launchSettings.json and either gives a friendly error message explaining the problem, or just creates it and moves on (self healing) with a warning raised maybe.

### Steps To Reproduce

1. Create a new aspire project from the aspire-starter template.
2. Delete the launchSettings.json from the AppHost
3. `aspire run --debug`

### Exceptions (if any)

```
[22:34:42] [dbug] DotNetCliRunner: AppHost process has exited. Unable to connect to backchannel at /home/lee/.aspire/cli/backchannels/cli.sock.81c46ad2e37444e994b1a06263f7c548 System.Net.Sockets.SocketException (99): Cannot assign requested address
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError, Boolean) + 0x7b
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket, CancellationToken) + 0xcf
at Aspire.Cli.Backchannel.AppHostCliBackchannel.d__19.MoveNext() + 0x379
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine&) + 0x5a
at Aspire.Cli.Backchannel.AppHostCliBackchannel.ConnectAsync(String, Boolean, CancellationToken) + 0x4c
at Aspire.Cli.DotNet.DotNetCliRunner.d__15.MoveNext() + 0x5dd
at System.Threading.ExecutionContext.RunInternal(ExecutionContext, ContextCallback, Object) + 0xa7
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread) + 0x63
at System.Threading.TimerQueueTimer.Fire(Boolean) + 0x4e
at System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x2ff
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() + 0x187
at System.Threading.Thread.StartThread(IntPtr) + 0x131
at System.Threading.Thread.ThreadEntryPoint(IntPtr) + 0x19
--- End of stack trace from previous location ---
at Aspire.Cli.Backchannel.AppHostCliBackchannel.d__19.MoveNext() + 0xec
--- End of stack trace from previous location ---
at Aspire.Cli.DotNet.DotNetCliRunner.d__15.MoveNext() + 0x311
[22:34:42] [fail] AspireCliTelemetry: An error occurred while connecting to the app host. The app host possibly crashed before it was available: AppHost process has exited unexpectedly.. Aspire.Cli.Backchannel.FailedToConnectBackchannelConnection: AppHost process has exited unexpectedly.
---> System.Net.Sockets.SocketException (99): Cannot assign requested address
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError, Boolean) + 0x7b
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket, CancellationToken) + 0xcf
at Aspire.Cli.Backchannel.AppHostCliBackchannel.d__19.MoveNext() + 0x379
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine&) + 0x5a
at Aspire.Cli.Backchannel.AppHostCliBackchannel.ConnectAsync(String, Boolean, CancellationToken) + 0x4c
at Aspire.Cli.DotNet.DotNetCliRunner.d__15.MoveNext() + 0x5dd
at System.Threading.ExecutionContext.RunInternal(ExecutionContext, ContextCallback, Object) + 0xa7
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread) + 0x63
at System.Threading.TimerQueueTimer.Fire(Boolean) + 0x4e
at System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x2ff
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() + 0x187
at System.Threading.Thread.StartThread(IntPtr) + 0x131
at System.Threading.Thread.ThreadEntryPoint(IntPtr) + 0x19
--- End of stack trace from previous location ---
at Aspire.Cli.Backchannel.AppHostCliBackchannel.d__19.MoveNext() + 0xec
--- End of stack trace from previous location ---
at Aspire.Cli.DotNet.DotNetCliRunner.d__15.MoveNext() + 0x311
--- End of inner exception stack trace ---
at Aspire.Cli.Commands.RunCommand.<>c__DisplayClass20_0.<b__0>d.MoveNext() + 0x54
--- End of stack trace from previous location ---
at Aspire.Cli.Interaction.ConsoleInteractionService.d__17`1.MoveNext() + 0x74
--- End of stack trace from previous location ---
at Aspire.Cli.Commands.RunCommand.d__20.MoveNext() + 0x5a8
❌ An error occurred while connecting to the app host. The app host possibly crashed before it was available: AppHost process has
exited unexpectedly..
📄 See logs at /home/lee/.aspire/logs/cli_20260320T223430_42816c55.log
[22:34:42] [dbug] Features: Feature check: updateNotificationsEnabled, ConfigKey: features:updateNotificationsEnabled, Value: '(null)', DefaultValue: True
[22:34:42] [dbug] Features: Feature updateNotificationsEnabled using default value: True
[22:34:42] [dbug] CliUpdateNotifier: Current version: 13.3.0-preview.1.26169.7
```

### .NET Version info

.NET SDK:
Version: 10.0.104
Commit: 80d3e14f5e
Workload version: 10.0.100-manifests.c7707153
MSBuild version: 18.0.11+80d3e14f5

Runtime Environment:
OS Name: linuxmint
OS Version: 22.3
OS Platform: Linux
RID: ubuntu.24.04-x64
Base Path: /usr/lib/dotnet/sdk/10.0.104/

.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.4
Architecture: x64
Commit: 80d3e14f5e

.NET SDKs installed:
10.0.104 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_BUNDLE_EXTRACT_BASE_DIR [/home/lee/.cache/dotnet_bundle_extract]

global.json file:
/home/lee/projects/qs-reborn-dotnet/global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

### Anything else?

Aspire version: 13.3.0-preview.1.26169.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.