Skip to content

Restore dev-certs diagnostics in Native AOT tools - #69534

Merged
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:fix/native-aot-dev-certs-diagnostics
Sep 28, 2026
Merged

akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:fix/native-aot-dev-certs-diagnostics

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Description

Restore existing dotnet dev-certs diagnostics in Native AOT builds (added in dotnet/dotnet#6720).

Certificate diagnostics, including the underlying exception and security import failure output, are delivered through CertificateManagerEventSource and an in-process ReporterEventListener. The shared Native AOT settings disable EventSource support, so these events aren't displayed, not even with --verbose. The final success/error messages still appear because they are written directly to the console.

Reenable EventSource support to fix that. This adds about 1MB to the size of the bundle library or standalone tool.

Verbose versus normal output

Failure details remain verbose-only: they use Error, while normal mode admits only Critical (none currently declared) and LogAlways.

The latter includes Linux/OpenSSL guidance to set or extend SSL_CERT_DIR (events 110, 111, and 114), so enabling EventSource also restores non-verbose guidance.

Validation

  • Reproduced the missing events with the published macOS arm64 aggregate.
  • The new regression test fails without EventSource support because the expected certificate-listing message is absent, and passes with the fix.
  • Exercised a real certificate-save failure using a temporary HOME with no login keychain, without modifying the real user keychain. Compared Release native aggregates built from the same source with EventSource disabled/enabled, with and without --verbose. All four runs exited with code 2 and printed the generic saving error. Only the enabled, verbose run also printed event 56 (security import failure output) and event 22 (the save exception). Both non-verbose runs printed only the generic error.
  • All 11 Native AOT tool tests pass in Release on macOS arm64, including the machine-readable certificate check and the user-secrets/user-jwts workflows.
  • Windows and Linux native execution were not validated locally; the Linux guidance descriptions above are based on source inspection.
source activate.sh
./src/Tools/build.sh \
  --projects "$PWD/src/Tools/NativeAot/test/Microsoft.AspNetCore.Tools.NativeAot.Tests.csproj" \
  --no-restore --test -c Release -v quiet

Enable EventSource support so existing certificate diagnostics reach the console. Scope the native-library warning suppression to the single-runtime aggregate and cover verbose output through its published launcher.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ff59a411-cb14-4088-a4a1-9e9c7c4901a4
Copilot AI lite review requested due to automatic review settings September 25, 2026 17:57
@github-actions github-actions Bot added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Windows and Linux native execution were not validated locally; final human review is warranted.

Review effort: Lite
Findings: None

What changed in this PR

Restores dotnet dev-certs diagnostics in Native AOT builds.

Changes:

  • Re-enables EventSource support.
  • Suppresses the expected shared-library warning.
  • Adds regression coverage for verbose diagnostics.
File Summary
src/​Tools/​NativeAot/​test/​NativeAotToolScenarioTests.cs Verifies verbose certificate diagnostics.
src/​Tools/​NativeAot/​aspnetcoretools/​aspnetcoretools.csproj Suppresses the Native AOT EventSource warning.
src/​Tools/​NativeAot/​AspNetCoreTools.NativeAot.props Enables EventSource support.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@akoeplinger

Copy link
Copy Markdown
Member Author

/cc @baronfel @DamianEdwards

@DamianEdwards

Copy link
Copy Markdown
Member

Seems reasonable to take this, worth the size increase.

@akoeplinger

Copy link
Copy Markdown
Member Author

/ba-g unrelated QUIC test failures

@akoeplinger
akoeplinger merged commit ff134c7 into dotnet:main Sep 28, 2026
26 of 28 checks passed
@akoeplinger
akoeplinger deleted the fix/native-aot-dev-certs-diagnostics branch September 28, 2026 17:07
@akoeplinger

Copy link
Copy Markdown
Member Author

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

wtgodbe pushed a commit that referenced this pull request Oct 1, 2026
Enable EventSource support so existing certificate diagnostics reach the console. Scope the native-library warning suppression to the single-runtime aggregate and cover verbose output through its published launcher.

Co-authored-by: Alexander Köplinger <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copilot-Session: ff59a411-cb14-4088-a4a1-9e9c7c4901a4
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants