A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.tracing.eventsource.writeevent below:

EventSource.WriteEvent Method (System.Diagnostics.Tracing) | Microsoft Learn

Source:
EventSource.cs
Source:
EventSource.cs
Source:
EventSource.cs
Source:
EventSource.cs

Writes an event by using the provided event identifier and string argument.

protected:
 void WriteEvent(int eventId, System::String ^ arg1);
protected void WriteEvent(int eventId, string arg1);
protected void WriteEvent(int eventId, string? arg1);
member this.WriteEvent : int * string -> unit
Protected Sub WriteEvent (eventId As Integer, arg1 As String)
Parameters
eventId
Int32

The event identifier. This value should be between 0 and 65535.

arg1
String

A string argument.

Examples

The following example shows how to use this method overload to write an event. This code example is part of a larger example provided for the EventSource class.

[Event(1, Message = "Application Failure: {0}", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]
public void Failure(string message) { WriteEvent(1, message); }
<[Event](1, Message:="Application Failure: {0}", Level:=EventLevel.Error, Keywords:=Keywords.Diagnostic)> _
Public Sub Failure(ByVal message As String)
    WriteEvent(1, message)
End Sub
Remarks

eventid should be greater than 0 or less than 65535 or errors can occur in the operation. If errors do occur, you can get more information about the source of the error by checking the output stream of the debugger, if you have a debugger attached to the process firing events. You can also look for errors reported in the ETW event stream, if you have an ETW listener on the event source where the error occurs.

When you implement a method that is identified as an ETW event in an EventSource-derived class. You must call the base class WriteEvent method passing the EventId and the same arguments as the implemented method similar to the following example.

[Event(2, Level = EventLevel.Informational)]
public void Info1(string arg1)
{
    base.WriteEvent(2, arg1);
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4