Open jborean93 opened 8 months ago
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti See info in area-owners.md if you want to be subscribed.
Author: | jborean93 |
---|---|
Assignees: | - |
Labels: | `area-System.Diagnostics.Tracing` |
Milestone: | - |
Hi @jborean93! I think you're right in that using EventSource with EventSourceSettings.EtwSelfDescribingEventFormat will not transmit the Message
metadata when writing events. metadata.Message
is not passed through https://github.com/dotnet/runtime/blob/5ca9043932b908edfb5f4281b2a5cd461c40c708/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs#L1414-L1421
However, I'm thinking that is by design, as it seems to me like self-describing events should transmit payloads that are self-sufficient.
On the other hand, using EventSource with EventSourceSettings.EtwManifestEventFormat will read the EventAttribute metadata when it creates a manifest and sends the manifest https://github.com/dotnet/runtime/blob/5ca9043932b908edfb5f4281b2a5cd461c40c708/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs#L2736-L2737
I tried out your repro using the EtwManifestEventFormat setting instead, and was able to collect via PerfView and see the FormattedMessage "foo bar".
Would using EtwManifestEventFormat work for you, or do you need to use EtwSelfDescribingEventFormat for your scenario?
Would using EtwManifestEventFormat work for you, or do you need to use EtwSelfDescribingEventFormat for your scenario?
It's been a while but at the time I had trouble using the manifest'd event source in newer versions of .NET. IIRC the underlying nuget package that actually was able to generate the manifest only worked up till net6.0 or something around that. Because of this I went with the self describing one which is a lot simpler to setup and use. I would have thought if one worked in one then it should work in the other which is why I opened this issue.
Description
I'm honestly not sure if I'm just missing something simple but it seems like the EventAttribute.Message value is not being written in the underlying ETW event on Windows.
I was originally working with AOT and thought that could be the cause but when creating a reproducer to compare I found the non-AOT scenario was also missing this value.
Reproduction Steps
With the csproj
I compiled with
dotnet publish
and just ran the exe.In my testing I am using my custom PowerShell module PSEtw by running the following in another admin PowerShell console when running the published exe from the above.
I've also reproduced the issue with PerfView and dotnet-trace and those are also missing the message data that I am expecting.
Expected behavior
I expect
EventMessage
to be the result offoo {0}
(foo bar
).Actual behavior
EventMessage
is not set. I've also noticedTask
is set to0
not1
as I would expect. This makes me even more suspicious I'm doing something wrong.Regression?
I've gone back to
net6.0
and it seems to have the same problem.Known Workarounds
No response
Configuration
Running with .NET 8 on Windows Server 2022 x64.
Other information
No response