Repository navigation
Clarify WriteEventCore arguments - #7925
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-tracing Issue DetailsFixes: dotnet/diagnostics#2608 WriteEventCore takes an array of EventData arguments but only provided a few
|
Fixes: dotnet/diagnostics#2608 WriteEventCore takes an array of EventData arguments but only provided a few sparse examples on how to initialize these values. Several of the types not shown have non-intuitive encodings that can't be inferred from the few examples. This change provides a more complete listing, in particular including bool, DateTime, string, and byte[] which are non-obvious.
e0a712b to
7b6c1bf
Compare
|
cc @dotnet/dotnet-diag |
|
Docs Build status updates of commit e0a712b: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
|
Docs Build status updates of commit 7b6c1bf: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
|
@gewarren What do you think on this one? Should we pull the code into an included sample? |
josalem
left a comment
There was a problem hiding this comment.
I think the code snippets are a good way to show this information.
|
Docs Build status updates of commit 105be8c: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
gfoidl
left a comment
There was a problem hiding this comment.
Some nits to follow coding standard in dotnet-org.
|
Docs Build status updates of commit 9bd8d8b: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
| desc.Size = 8; | ||
|
|
||
| // string arg | ||
| fixed(byte* ptr = arg) |
There was a problem hiding this comment.
Shouldn't that be char* ptr?
| fixed(byte* ptr = arg) | ||
| { | ||
| int length = arg.Length; | ||
| desc.DataPointer = ptr; |
There was a problem hiding this comment.
This needs a cast to IntPtr.
| { | ||
| int length = arg.Length; | ||
| desc.DataPointer = ptr; | ||
| desc.Size = (arg.Length + 1) * 2; // strings use 2 byte per char UTF16 encoding and a null terminator at the end |
There was a problem hiding this comment.
Please add a note saying that the string must not contain embedded null characters. ETW consumers expect the string to end at the first null character.
|
@KalleOlaviNiemitalo - thanks for catching my mistakes : ) I opened a new PR since this one had already merged. |
Fixes: dotnet/diagnostics#2608
WriteEventCore takes an array of EventData arguments but only provided a few
sparse examples on how to initialize these values. Several of the types not shown
have non-intuitive encodings that can't be inferred from the few examples. This
change provides a more complete listing, in particular including bool, DateTime,
string, and byte[] which are non-obvious.