Skip to content

Events using &OsStr don't seem to serialize properly #2

@rylev

Description

@rylev
```rust
use win_etw_macros::trace_logging_provider;
use std::ffi::OsStr;

#[trace_logging_provider(guid = "89d6f527-86d0-4da1-8b4b-b050159a1d96")]
pub trait MyAppEvents {
    #[event(opcode = 1)]
    fn database_connection_created(connection_id: u64, server: &OsStr);
    #[event(opcode = 2)]
    fn database_connection_closed(connection_id: u64);
    // ...
}

fn main() {
    let events = MyAppEvents::new();
    events.database_connection_created(None, 35, OsStr::new("foer"));
    events.database_connection_closed(None, 35);

shows up as
00000022 MyAppEvents 14796 14352 1 0 05\22\2020-20:41:31:607 {"connection_id":35,"server":"fo","meta":{"provider":"MyAppEvents","event":"database_connection_created","time":"2020-05-22T20:41:31.607","cpu":1,"pid":14796,"tid":14352,"channel":11,"level":4,"opcode":1}}

in TraceView. Notice that server comes out as "fo" instead of "foer".

Originally posted here by @jrmuizel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions