Skip to content

Add Missing WCF Event Templates#2390

Merged
brianrob merged 5 commits intomicrosoft:mainfrom
brianrob:brianrob/missing-wcf-event-metadata
Mar 30, 2026
Merged

Add Missing WCF Event Templates#2390
brianrob merged 5 commits intomicrosoft:mainfrom
brianrob:brianrob/missing-wcf-event-metadata

Conversation

@brianrob
Copy link
Copy Markdown
Member

@brianrob brianrob commented Mar 20, 2026

Summary

The ApplicationServerTraceEventParser had event ID constants defined for 16 WCF infrastructure events (57394–57410) but was missing the corresponding event handler properties and template entries in EnumerateTemplates(). This caused these events to display as EventID(57394) etc. instead of their proper names like HandledException and ThrowingEtwException.

Additionally, ApplicationServerTraceEventParser was not registered as a standard parser in TraceLog, so PerfView's ETLX conversion/read path never instantiated it.

Changes

ApplicationServerTraceEventParser.cs

Added 16 missing event handler properties and template registrations for:

  • HandledException (57394), ShipAssertExceptionMessage (57395), ThrowingException (57396), UnhandledException (57397)
  • TraceCodeEventLog* variants (57399–57403)
  • HandledExceptionWarning/Error/Verbose (57404–57406)
  • ThrowingExceptionVerbose (57407), EtwUnhandledException (57408)
  • ThrowingEtwExceptionVerbose (57409), ThrowingEtwException (57410)

Template types and field definitions were matched to the WCF ETW manifest (Microsoft-Windows-Application Server-Applications provider).

TraceLog.cs

Registered ApplicationServerTraceEventParser in RegisterStandardParsers() so PerfView resolves these event names when reading ETLX files.

Testing

  • All TraceEvent tests pass (2179 net8.0 + 2196 net462, 0 failures)
  • Verified end-to-end via TraceLog.OpenOrConvert (PerfView's code path) — events 57394 and 57410 now resolve as HandledException and ThrowingEtwException with proper payload fields

@brianrob brianrob changed the title Add missing WCF infrastructure event templates Add Missing WCF Event Templates Mar 20, 2026
@brianrob brianrob marked this pull request as ready for review March 20, 2026 19:36
@brianrob brianrob requested a review from a team as a code owner March 20, 2026 19:36
leculver
leculver previously approved these changes Mar 24, 2026
Copy link
Copy Markdown
Collaborator

@leculver leculver left a comment

Choose a reason for hiding this comment

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

LGTM. Though any reason you skipped 57398?

add
{
// action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName
source.RegisterEventTemplate(new ThreeStringsTemplateEATraceData(value, 57394, 8140, "HandledException", Guid.Empty, 0, "Info", ProviderGuid, ProviderName));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where are you getting a Task value of 8140 from? Looking at the WCF code, it looks to me like it's being emitted with the Task field in the EventDescriptor set to 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mconnew this looks like it was copilot-hallucinated. They should all be 0 now.

@brianrob brianrob force-pushed the brianrob/missing-wcf-event-metadata branch 3 times, most recently from c3bf7c6 to f399f52 Compare March 25, 2026 18:53
brianrob and others added 2 commits March 25, 2026 16:03
- Rename ServiceAction to SoapAction in Multidata22TemplateHATraceData to fix
  bug where PayloadValue(0) and ToXml() resolved to the Action<T> delegate
  instead of the string property
- Replace 0xFFFF sentinel event IDs with correct IDs for 7 events:
  39456-39460 (workflow tracking), 57398 (MaxInstancesExceeded),
  62326 (HttpHandlerPickedForUrl)
- Add 17 missing infrastructure events (IDs 57393-57410, except 57398)
  with event properties and template registrations
- Expand EnumerateTemplates array from 464 to 481 entries

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ApplicationServerTraceEventParser to RegisterStandardParsers() so
WCF events are automatically parsed when processing ETL/ETLX files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brianrob brianrob force-pushed the brianrob/missing-wcf-event-metadata branch from f399f52 to 50a54a7 Compare March 26, 2026 22:52
@brianrob
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

brianrob and others added 3 commits March 27, 2026 15:04
Fixed 4 issues in the synthetic nettrace trace test:

1. Chunk05 metadataId propagation: WriteEvents_Chunk05 used a local 'id'
   variable but never propagated it back to the ref parameter, causing all
   subsequent chunks (06+) to reference wrong metadata IDs.

2. Chunk05 threadIndex: Changed from 0 to 999 for consistency with all
   other chunks.

3. Chunk09 metadataId calculation: Fixed baseMetadataId = __metadataId - 37
   to baseMetadataId = __metadataId (the -37 offset was incorrect) and
   added proper metadataId advancement (+37) after writing events.

4. Chunk01 template fields: Removed spurious EventTime (FileTime) fields
   from all 12 TemplateHA field arrays. The parser skips EventTime and
   reads subsequent fields at offsets that assume it is not present.
   Updated two validation indices (IsFaultSource 12->11, SubInstanceID
   4->3) to match the corrected field positions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…erviceAction back-compat alias

- Fix 17 new events (57393-57410) to unregister with correct event ID
  and ProviderGuid instead of (0, Guid.Empty)
- Add [Obsolete] ServiceAction property alias on Multidata22TemplateHATraceData
  to preserve API compatibility after the SoapAction rename

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change firedEvents dictionary key from int (event ID) to string (event name)
- Use event name-based variable names in Validate methods
- Remove event ID numbers from comments and assert messages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants