-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-System.Diagnostics.TracingenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsquestionAnswer questions and provide assistance, not an issue with source code or documentation.Answer questions and provide assistance, not an issue with source code or documentation.
Milestone
Description
Background and motivation
According to eventsource-getting-started
Eventone must call like WriteEvent or WriteEventCore to write event.
But this is a regular code.
API Proposal
No any changed, but the partial base on EventSource class, partial method and has EventAttribute method will be generated.
API Usage
internal sealed unsafe /*It's mandatory or in method write unsafe*/ partial class RuntimeEventSource : EventSource
{
[Event(1)]
public partial void GoHome(string address,double usedTime);
}
//Will generated
public void GoHome(string address,double usedTime)
{
address ??= System.String.Empty;
global::System.Diagnostics.Tracing.EventSource.EventData* datas = stackalloc global::System.Diagnostics.Tracing.EventSource.EventData[2];
fixed(char* addressPtr = address)
{
datas[0] = new global::System.Diagnostics.Tracing.EventSource.EventData
{
DataPointer = addressPtr,
Size = (address.Length + 1) * sizeof(char)
};
datas[1] = new global::System.Diagnostics.Tracing.EventSource.EventData
{
DataPointer = (nint)(&usedTime),
Size = sizeof(double)
};
WriteEventWithRelatedActivityIdCore(1, null, 2, datas);
}
}Alternative Designs
No
Risks
No
Metadata
Metadata
Assignees
Labels
area-System.Diagnostics.TracingenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsquestionAnswer questions and provide assistance, not an issue with source code or documentation.Answer questions and provide assistance, not an issue with source code or documentation.