Add test helper and test cases to validate EventSource IDs#65408
Merged
danegsta merged 6 commits intodotnet:mainfrom Feb 13, 2026
Merged
Add test helper and test cases to validate EventSource IDs#65408danegsta merged 6 commits intodotnet:mainfrom
danegsta merged 6 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a reusable test helper to validate EventSource event ID correctness (matching [Event(N)] to WriteEvent(N, ...) and detecting duplicates), and wires it into several existing test suites to catch misconfigured event IDs in CI.
Changes:
- Introduces
EventSourceValidatorhelper based onEventSource.GenerateManifest(..., EventManifestOptions.Strict)plus duplicate-ID detection. - Adds focused unit tests for the validator itself.
- Adds “EventIdsAreConsistent” tests for existing EventSources and documents the recommended pattern.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Testing/src/Tracing/EventSourceValidator.cs | New validator utility for Event ID consistency and duplicate detection. |
| src/Testing/test/EventSourceValidatorTests.cs | Unit tests validating validator behavior (pass, mismatch, duplicates, invalid types). |
| src/SignalR/common/Http.Connections/test/Internal/HttpConnectionsEventSourceTests.cs | Adds EventSource ID consistency test for HttpConnectionsEventSource. |
| src/Shared/test/Shared.Tests/CertificateManagerEventSourceTests.cs | Adds EventSource ID consistency test for CertificateManagerEventSource. |
| src/Servers/Kestrel/Core/test/KestrelEventSourceTests.cs | Adds EventSource ID consistency test for Kestrel’s internal KestrelEventSource. |
| src/Hosting/Hosting/test/Internal/HostingEventSourceTests.cs | Adds EventSource ID consistency test for HostingEventSource. |
| docs/EventSourceAndCounters.md | Documents the new validator and recommends adding a one-line consistency test for new EventSources. |
eerhardt
reviewed
Feb 12, 2026
eerhardt
approved these changes
Feb 12, 2026
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add additional validation for EventSource IDs to catch misconfigured IDs in CI
New test helper and unit tests for EventSource IDs
Description
Adds a new EventSourceValidator test helper that ensures WriteEvent IDs match the configured Metadata ID and ensures no duplicate IDs are introduced for a given EventSource. Adds tests to run the helper for existing EventSources in the project. Checks for duplicate IDs and Event/WriteEvent ID mismatches.
Fixes #65407