Skip to content

Declare the EventPipe provider callback is_enabled as uint32_t - #138179

Merged
lewing merged 2 commits into
dotnet:mainfrom
lewing:lewing-eventpipe-callback-is-enabled
Nov 24, 2026
Merged

lewing merged 2 commits into
dotnet:mainfrom
lewing:lewing-eventpipe-callback-is-enabled

Conversation

@lewing

@lewing lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member

EventPipeCallback mirrors the ETW EnableCallback and the profiler EventPipeProviderCallback (corprof.idl), which both pass a 32-bit is_enabled. EventPipeCreateProvider2 casts the profiler callback directly to EventPipeCallback, and the managed and native callbacks also take 32 bits. Declaring it unsigned long made it 64-bit on LP64 targets. On wasm64, where call_indirect checks signatures exactly, this crashes System.Diagnostics.Tracing.Tests with "function signature mismatch". Windows and 32-bit targets are unchanged.

Note

This PR description was generated with GitHub Copilot.

The callback mirrors the ETW EnableCallback and the profiler
EventPipeProviderCallback, which both pass a 32-bit IsEnabled, and managed
and native implementations take 32 bits. unsigned long is 64-bit on LP64
targets, which makes the indirect call a wasm64 signature mismatch.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit c2cad28)
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lewing

lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@lateralusX what is the correct thing here?

The native EventPipe test runtime and test callbacks still declared the
callback's control code as unsigned long, which no longer matches the
EventPipeCallback typedef.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 009cdd9)

@lateralusX lateralusX left a comment •

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.

LGTM! CoreCLR/NativeAOT callbacks use ULONG, that gets typedef to unsigned int in the PAL and I guess the port of EventPipe over to C incorrectly mapped that parameter to unsinged long, but since that will be passed in a register on 64-bit architectures, it didn't cause any issues and remain hidden, until now.

@lewing

lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

/ba-g failures are known and unrelated

@lewing
lewing merged commit fd82bf2 into dotnet:main Nov 24, 2026
118 of 120 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants