Skip to content

Fix Debug.Assert failures in SpeedScope tests and DynamicTraceEventParser#2368

Merged
brianrob merged 1 commit into
microsoft:mainfrom
brianrob:brianrob/throwsexception-test
Feb 23, 2026
Merged

Fix Debug.Assert failures in SpeedScope tests and DynamicTraceEventParser#2368
brianrob merged 1 commit into
microsoft:mainfrom
brianrob:brianrob/throwsexception-test

Conversation

@brianrob

@brianrob brianrob commented Feb 20, 2026

Copy link
Copy Markdown
Member

The SpeedScope CanConvertProvidedTraceFiles tests were clearing Trace.Listeners to suppress Debug.Assert failures that fired during trace parsing. This masked two real bugs:

Fix 1: Duplicate template enumeration in DynamicTraceEventParser

DynamicTraceEventParser.EnumerateTemplates enumerates templates from three sources (manifest-based, registeredParser, and eventPipeTraceEventParser) but only deduplicated between manifest-based templates and registeredParser. When both registeredParser and eventPipeTraceEventParser knew about the same event, the template was enumerated twice, causing Subscribe to assert on the duplicate with mayHaveExistedBefore=false.

Fix: Filter eventPipeTraceEventParser templates against registeredParser, matching the existing dedup pattern for manifest-based templates.

Fix 2: Skip ConfirmAllEventsAreInEnumeration for ApplicationServerTraceEventParser

ApplicationServerTraceEventParser is auto-generated and has many events that share the same task name and opcode, producing duplicate computed event names (100+ duplicates). The ConfirmAllEventsAreInEnumeration DEBUG validation cannot handle this pattern.

Fix: Skip this parser from the validation, similar to how PredefinedDynamicTraceEventParser is already excluded.

Cleanup

  • Remove the listener-clearing hack from SpeedScope tests (no longer needed since the underlying asserts are fixed).
  • Add documentation to ThrowingTraceListener and DebugAssertionTests explaining that on .NET 5+, the DefaultTraceListener already throws on assert failures, so no additional listener configuration is needed.

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

1 similar comment
@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

1 similar comment
@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

1 similar comment
@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@brianrob

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

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