Closed Mathijss closed 3 weeks ago
I can confirm this happening. Also, when using the new Persistent Container Lifetime feature of Aspire 9, Docker will still create new networks when restarting dotnet watch
in the terminal. Because these are linked to the persistent/running container, they also can't be removed by running docker network prune
without also manually stopping the container.
dotnet watch is being re-designed to work with aspire, what is currently there does not work well. This problem in particular requires changes to how dotnet watch shuts down the app host.
See https://github.com/dotnet/sdk/issues/44542
Unfortunately this won't be fixed for .NET 9 GA it'll be in a follow up SDK release. It is actively being worked on.
Is there an existing issue for this?
Describe the bug
Using dotnet watch to run aspire has some issues.
Aspire will create network bridges in docker
running "docker network ls" will list the network bridges in use for aspire. Initially it will list something like:
NETWORK ID NAME DRIVER SCOPE 59f04da376bd bridge bridge local c7a8a6254807 default-aspire-network-nfu4784ci4 bridge local 507ada05463c host host local ea5f563cd5ba none null local
After several reloads it will also leave older bridges:
NETWORK ID NAME DRIVER SCOPE 59f04da376bd bridge bridge local c7a8a6254807 default-aspire-network-nfu4784ci4 bridge local 7551d86169a3 default-aspire-network-vut5m4upd4 bridge local 507ada05463c host host local ea5f563cd5ba none null local
This will cause error like in your console:
could not create a network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 2, "Network": "default-aspire-network-oi5fdhpdd4", "error": "object not found\nnetwork not found\ndocker command 'CreateNetwork' returned with non-zero exit code 1: command output: Stdout: '' Stderr: 'Error response from daemon: all predefined address pools have been fully subnetted\n'"}
Using persistent containers will not help this issue.
Expected Behavior
I expect using "dotnet watch" in combination with aspire to either not work or be fully functional (at very least not causing my local docker instance to fail).
Steps To Reproduce
run "dotnet watch" on an aspire project hit control-r
additional resources get created that never get cleaned up.
Exceptions (if any)
No response
.NET Version info
.NET SDK: Version: 9.0.100-rc.2.24474.11 Commit: 315e1305db Workload version: 9.0.100-manifests.cea95dba MSBuild version: 17.12.0-preview-24473-03+fea15fbd1
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.2.24474.11\
.NET workloads installed: [maui-windows] Installation Source: VS 17.11.35312.102 Manifest Version: 9.0.0-preview.6.24327.7/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.maui\9.0.0-preview.6.24327.7\WorkloadManifest.json Install Type: Msi
[maccatalyst] Installation Source: VS 17.11.35312.102 Manifest Version: 17.2.9714-net9-p6/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.maccatalyst\17.2.9714-net9-p6\WorkloadManifest.json Install Type: Msi
[ios] Installation Source: VS 17.11.35312.102 Manifest Version: 17.2.9714-net9-p6/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.ios\17.2.9714-net9-p6\WorkloadManifest.json Install Type: Msi
[aspire] Installation Source: VS 17.11.35312.102 Manifest Version: 8.2.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json Install Type: Msi
[android] Installation Source: VS 17.11.35312.102 Manifest Version: 34.99.0-preview.6.340/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.android\34.99.0-preview.6.340\WorkloadManifest.json Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host: Version: 9.0.0-rc.2.24473.5 Architecture: x64 Commit: 990ebf52fc
.NET SDKs installed: 2.1.818 [C:\Program Files\dotnet\sdk] 6.0.427 [C:\Program Files\dotnet\sdk] 7.0.317 [C:\Program Files\dotnet\sdk] 8.0.100-preview.6.23330.14 [C:\Program Files\dotnet\sdk] 8.0.206 [C:\Program Files\dotnet\sdk] 8.0.306 [C:\Program Files\dotnet\sdk] 8.0.400 [C:\Program Files\dotnet\sdk] 9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-preview.6.23329.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: 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
Anything else?
Aspire.AppHost.Sdk Version="9.0.0-rc.1.24511.1" TargetFramwork: net9.0
using vs-code