Skip to content

Fix dotnet dev-certs https --trust failures on Ubuntu with exit code checking#1131

Merged
aaronpowell merged 6 commits intomainfrom
copilot/fix-ci-jobs-failure
Feb 17, 2026
Merged

Fix dotnet dev-certs https --trust failures on Ubuntu with exit code checking#1131
aaronpowell merged 6 commits intomainfrom
copilot/fix-ci-jobs-failure

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

CI failing on ubuntu-latest with .NET SDK 10.0.103+ due to aspnetcore#65391. The --trust flag triggers an EventSource bug causing exit code 4.

Changes

  • .github/actions/setup-runtimes-caching/action.yml: Add exit code checking to handle partial trust scenario
  • .devcontainer/post-create.sh: Add exit code checking to handle partial trust scenario

The fix applies the recommended workaround from the upstream issue by checking exit codes. Exit code 4 indicates partial trust (certificate is trusted by some clients but not others), which is acceptable. Other non-zero exit codes indicate actual failures.

     - name: Setup .NET dev certs
       shell: bash
       if: ${{ matrix.os == 'ubuntu-latest' }}
       run: |
+        EXIT_CODE=0
+        dotnet dev-certs https --trust || EXIT_CODE=$?
+        if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 4 ]; then
+          echo "dotnet dev-certs https --trust failed with exit code $EXIT_CODE"
+          exit $EXIT_CODE
+        fi
-        dotnet dev-certs https --trust
 echo Install .NET dev certs
+EXIT_CODE=0
+dotnet dev-certs https --trust || EXIT_CODE=$?
+if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 4 ]; then
+  echo "dotnet dev-certs https --trust failed with exit code $EXIT_CODE"
+  exit $EXIT_CODE
+fi
-dotnet dev-certs https --trust

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The --trust flag causes failures on GitHub Actions ubuntu-latest runners
with .NET SDK 10.0.103+ due to a bug in ASP.NET Core. Since the trust
functionality doesn't work properly on Linux anyway, we remove the flag.

Fixes: dotnet/aspnetcore#65391

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI jobs failure due to issue 65391 Remove --trust flag from dotnet dev-certs on Ubuntu Feb 17, 2026
Copilot AI requested a review from aaronpowell February 17, 2026 03:50
@aaronpowell
Copy link
Member

@copilot that wasn't the right fix, we need to add this:

        env:
          WSL_INTEROP: ""

As per: dotnet/aspnetcore#65391 (comment)

Copilot AI and others added 2 commits February 17, 2026 04:04
The correct fix for the dotnet dev-certs https --trust issue on Ubuntu
is to set the WSL_INTEROP environment variable to an empty string, which
prevents the WSL interop layer from interfering with the command.

This reverts the previous approach of removing --trust and implements
the recommended workaround from:
dotnet/aspnetcore#65391 (comment)

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
The same fix is needed in the devcontainer post-create script to prevent
the same issue from occurring when setting up development environments.

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot that wasn't the right fix, we need to add this:

...

Fixed! Applied the WSL_INTEROP: "" workaround in commit 0271939 (GitHub Actions) and 4a6c339 (devcontainer). The --trust flag is now kept with the environment variable set to prevent WSL interop interference.

Copilot AI changed the title Remove --trust flag from dotnet dev-certs on Ubuntu Fix dotnet dev-certs https --trust failures on Ubuntu with WSL_INTEROP workaround Feb 17, 2026
@aaronpowell
Copy link
Member

@copilot looks like that one didn't work, try the workaround in dotnet/aspnetcore#65391 (comment)

The WSL_INTEROP workaround didn't work. Instead, use the recommended
approach of checking exit codes. Exit code 4 indicates partial trust
(which is acceptable), while other non-zero exit codes indicate failure.

This allows the certificate setup to succeed when it's partially trusted
but still fail on actual errors.

Based on: dotnet/aspnetcore#65391 (comment)

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot looks like that one didn't work, try the workaround in dotnet/aspnetcore#65391 (comment)

Applied the exit code checking workaround in commit d17e12a. The command now succeeds with exit code 0 or 4 (partial trust), but fails on other non-zero codes.

Copilot AI changed the title Fix dotnet dev-certs https --trust failures on Ubuntu with WSL_INTEROP workaround Fix dotnet dev-certs https --trust failures on Ubuntu with exit code checking Feb 17, 2026
Copilot AI temporarily deployed to azure-artifacts February 17, 2026 04:22 Inactive
@aaronpowell aaronpowell marked this pull request as ready for review February 17, 2026 04:29
Copilot AI review requested due to automatic review settings February 17, 2026 04:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CI/devcontainer setup scripts to tolerate the .NET SDK 10.0.103+ Ubuntu dotnet dev-certs https --trust “partial trust” behavior (exit code 4), preventing spurious failures while still failing on real errors.

Changes:

  • Add exit-code capture/validation around dotnet dev-certs https --trust in the composite GitHub Action for Ubuntu CI runs.
  • Add the same exit-code capture/validation in the devcontainer post-create script.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/actions/setup-runtimes-caching/action.yml Wraps dotnet dev-certs https --trust with exit code handling to accept code 4 on Ubuntu.
.devcontainer/post-create.sh Mirrors the CI workaround in local devcontainer initialization to avoid setup failures.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aaronpowell aaronpowell merged commit 0949476 into main Feb 17, 2026
117 checks passed
@aaronpowell aaronpowell deleted the copilot/fix-ci-jobs-failure branch February 17, 2026 04:58
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 76
CommunityToolkit.Aspire.Hosting.ActiveMQ 78% 40% 108
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 74% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 29% 7% 124
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 62% 38% 80
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Azure.Extensions 64% 30% 54
CommunityToolkit.Aspire.Hosting.Bun 96% 83% 28
CommunityToolkit.Aspire.Hosting.Dapr 60% 37% 856
CommunityToolkit.Aspire.Hosting.DbGate 95% 50% 20
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 44
CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions 99% 93% 46
CommunityToolkit.Aspire.Hosting.Flagd 79% 100% 32
CommunityToolkit.Aspire.Hosting.Flyway 94% 100% 8
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 88% 73% 36
CommunityToolkit.Aspire.Hosting.Golang 60% 48% 120
CommunityToolkit.Aspire.Hosting.Java 70% 75% 130
CommunityToolkit.Aspire.Hosting.JavaScript.Extensions 97% 85% 200
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 22
CommunityToolkit.Aspire.Hosting.KurrentDB 71% 75% 34
CommunityToolkit.Aspire.Hosting.LavinMQ 74% 50% 26
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 85% 50% 22
CommunityToolkit.Aspire.Hosting.McpInspector 78% 45% 210
CommunityToolkit.Aspire.Hosting.Meilisearch 71% 57% 58
CommunityToolkit.Aspire.Hosting.Minio 88% 75% 56
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 95% 90% 20
CommunityToolkit.Aspire.Hosting.MySql.Extensions 98% 92% 62
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.Ollama 65% 69% 260
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 84% 79% 37
CommunityToolkit.Aspire.Hosting.PapercutSmtp 81% 50% 18
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 98% 90% 74
CommunityToolkit.Aspire.Hosting.Python.Extensions 45% 29% 100
CommunityToolkit.Aspire.Hosting.RavenDB 56% 45% 184
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 28
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.Sftp 59% 32% 40
CommunityToolkit.Aspire.Hosting.Solr 72% 100% 22
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 51% 48% 192
CommunityToolkit.Aspire.Hosting.Sqlite 89% 89% 52
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 98% 90% 62
CommunityToolkit.Aspire.Hosting.Stripe 51% 30% 82
CommunityToolkit.Aspire.Hosting.SurrealDb 55% 40% 258
CommunityToolkit.Aspire.Hosting.Umami 71% 75% 16
CommunityToolkit.Aspire.KurrentDB 94% 92% 54
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 61% 58% 114
CommunityToolkit.Aspire.Minio.Client 90% 85% 112
CommunityToolkit.Aspire.OllamaSharp 78% 71% 134
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.Sftp 86% 78% 86
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 68% (8010 / 11817) 55% (2164 / 3914) 5050

Minimum allowed line rate is 60%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants