aspire: Aspire failing in GitHub Codespace

Hi, Team.

When the current AppHost is running in GitHub Codespaces (and possibly in devcontainer), I found a few issues:

  1. The dashboard page is not automatically opening - (Related to #655 ) Either Blazor app or API app automatically opens a new tab when I run it individually. But, the dashboard doesn’t automatically open a new page. Instead I have to manually find the page and open it through the port forwarding tab.
  • #1296

    "applicationUrl": "http://localhost:<random_port_number>",
    "environmentVariables": {
      "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:<random_port_number>"
    }
    

    I initially expected that the applicationUrl attribute will be used to launch the dashboard page, but it uses http://localhost:18888. I’m not sure what these applicationUrl and DOTNET_DASHBOARD_OTLP_ENDPOINT_URL are for.

  • #1297

  • #1298

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (15 by maintainers)

Most upvoted comments

I did some experimentation this weekend on how to make the upcoming version of .NET Aspire (9.0) work with GitHub Codespaces. Here is what I did.

The first step is creating a GitHub repo and creating a new .NET Aspire project in it (I used the starter project). Next I opened that container and tweaked the .devcontainer file:

https://github.com/mitchdenny/aspire-withcodespaces/blob/main/.devcontainer/devcontainer.json

Then in the Program.cs of the AppHost I created this extension method class:

https://github.com/mitchdenny/aspire-withcodespaces/blob/448476fce79258e3a927634c7cba72c2c8795982/CustomResources.AppHost/Program.cs#L21-L82

And wired it up to the builder like this:

https://github.com/mitchdenny/aspire-withcodespaces/blob/448476fce79258e3a927634c7cba72c2c8795982/CustomResources.AppHost/Program.cs#L7

Then you should just be able to install the C# extensions and F5 the project and it’ll start up. The WithCodespaces(...) extension figures out the right forwarded URLs and replaces them on the dashboard:

image

@bradygaster this currently blocks the Aspire templates from publication to curated collection, due to invalid devcontainer config. Would love to chat about this.

@kvenkatrajan I assigned this to you.

Thanks @justinyoo this was a bit of a compound issue, so I logged them individually.