Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ When the app is trimmed with the following feature settings in the project file,
<RuntimeHostConfigurationOption Include="Feature.IsSupported" Value="false" />
</ItemGroup>
```

]]></format>
</example>
</Docs>
Expand Down
9 changes: 3 additions & 6 deletions xml/System.Diagnostics.Tracing/EventSource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3088,9 +3088,9 @@ public void Info1(string arg1)
## 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 <xref:System.Diagnostics.Tracing.EventSource>-derived class. You must call the base class <xref:System.Diagnostics.Tracing.EventSource.WriteEvent%2A> method passing the <xref:System.Diagnostics.Tracing.EventAttribute.EventId%2A> and the same arguments as the implemented method similar to the following example.
When you implement a method that's identified as an ETW event in an <xref:System.Diagnostics.Tracing.EventSource>-derived class, you must call the base class <xref:System.Diagnostics.Tracing.EventSource.WriteEvent%2A> method passing the <xref:System.Diagnostics.Tracing.EventAttribute.EventId%2A> and the same arguments as the implemented method similar to the following example.

```
```csharp
[Event(2, Level = EventLevel.Informational)]
public void Info1(Int64 arg1, string arg2)
{
Expand Down Expand Up @@ -3697,13 +3697,11 @@ public void Info1(string arg1)
The following example shows how to add a <xref:System.Diagnostics.Tracing.EventSource.WriteEvent%2A> overload that accepts four arguments. An example would be if you have a logging event that logs a string and 3 integers.

```csharp

[Event(1)]
public void LogTime(string tag, int hour, int minute, int second)
{
WriteEvent(1, tag, hour, minute, second);
}

```

You could do this without calling <xref:System.Diagnostics.Tracing.EventSource.WriteEventCore%2A>, but it would be slower than it needs to be. That is because it uses arrays and reflection to figure out what to do. If you log these at a high rate (> 1000 / sec), it can be worth making a fast helper, as shown in the following example. The method shadows the existing <xref:System.Diagnostics.Tracing.EventSource.WriteEvent%2A>. Thus the original caller code (LogTime) does not actually change, but the C# compiler will use the more specialized version which will be faster.
Expand Down Expand Up @@ -3734,10 +3732,9 @@ class AnotherEventSource : EventSource {
}
}
}

```

These are the expected sizes and data encodings for standard serializable types:
These are the expected sizes and data encodings for standard serializable types:

```csharp
// bool arg
Expand Down
12 changes: 3 additions & 9 deletions xml/System.Diagnostics/Debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1264,13 +1264,11 @@ The following example sets the indent level and emits debugging messages.

This example produces the following output:

```

```txt
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors

```

]]></format>
Expand Down Expand Up @@ -1338,13 +1336,11 @@ The following example sets the indent level and emits debugging messages.

This example produces the following output:

```

```txt
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors

```

]]></format>
Expand Down Expand Up @@ -1713,13 +1709,11 @@ The following example sets the indent level and emits debugging messages.

This example produces the following output:

```

```txt
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors

```

]]></format>
Expand Down
32 changes: 16 additions & 16 deletions xml/System.Diagnostics/EventLog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings. Specifically, resource identifier 5001 is defined for the localized name of the event log.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -2513,15 +2513,15 @@ SVC_UPDATE.EXE
<summary>This property is deprecated.</summary>
<value>To be added.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<format type="text/markdown"><![CDATA[

## Remarks

> [!IMPORTANT]
> Support for the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> property was removed in Windows Vista and later operating systems. Setting this value can cause the Event Log to never overwrite events, and to drop all events to the channel once it is full.
## Examples
The following example enumerates the event logs defined on the local computer, and displays configuration details for each event log.

## Examples
The following example enumerates the event logs defined on the local computer, and displays configuration details for each event log.

:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Diagnostics/EventLog/GetEventLogs/source1.cs" id="Snippet2":::
Expand Down Expand Up @@ -2587,11 +2587,11 @@ SVC_UPDATE.EXE
The <xref:System.Diagnostics.EventLog.ModifyOverflowPolicy%2A> method configures the overflow behavior of an event log. <xref:System.Diagnostics.EventLog> instance. After calling this method for the event log specified by the <xref:System.Diagnostics.EventLog.Log%2A> property, the <xref:System.Diagnostics.EventLog.OverflowAction%2A> and <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> property values reflect the newly configured overflow behavior.

> [!NOTE]
> This property represents a configuration setting for the event log represented by this instance. When the event log reaches its maximum size, this property specifies how the operating system handles new entries written by all event sources registered for the event log.

Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded> to indicate that a new entry overwrites the oldest entry when the <xref:System.Diagnostics.EventLog> reaches its maximum size. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded>, the `retentionDays` parameter value is ignored.
> This property represents a configuration setting for the event log represented by this instance. When the event log reaches its maximum size, this property specifies how the operating system handles new entries written by all event sources registered for the event log.

Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite> to discard new events when the maximum log size is reached. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite>, the `retentionDays` parameter value is ignored.
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded> to indicate that a new entry overwrites the oldest entry when the <xref:System.Diagnostics.EventLog> reaches its maximum size. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded>, the `retentionDays` parameter value is ignored.

Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite> to discard new events when the maximum log size is reached. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite>, the `retentionDays` parameter value is ignored.

> [!WARNING]
> Never set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteOlder>. This value is deprecated and might cause the log to behave as if the `DoNotOverwrite` parameter was passed instead.
Expand Down Expand Up @@ -2756,7 +2756,7 @@ SVC_UPDATE.EXE

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings. Specifically, resource identifier 5001 is defined for the localized name of the event log.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -4446,7 +4446,7 @@ SVC_UPDATE.EXE

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -4679,7 +4679,7 @@ SVC_UPDATE.EXE

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -4898,7 +4898,7 @@ SVC_UPDATE.EXE

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -5117,7 +5117,7 @@ SVC_UPDATE.EXE

The example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down
13 changes: 6 additions & 7 deletions xml/System.Diagnostics/EventLogInstaller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

The code example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -311,7 +311,7 @@ SVC_UPDATE.EXE

The code example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -670,7 +670,7 @@ SVC_UPDATE.EXE

The code example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down Expand Up @@ -835,8 +835,7 @@ SVC_UPDATE.EXE

For example, the following section of a message text file defines a string with a parameter placeholder:

```

```txt
MessageId = 1501
Severity = Success
Facility = Application
Expand All @@ -848,7 +847,7 @@ Component %%6050 is starting.

Within the parameter resource file, the insertion string must be defined with the resource identifier that corresponds to the placeholder, as shown below:

```
```txt
MessageId = 6050
Severity = Success
Facility = Application
Expand All @@ -875,7 +874,7 @@ TRIGGER.EXE

The code example uses the following message text file, built into the resource library EventLogMsgs.dll. A message text file is the source from which the message resource file is created. The message text file defines the resource identifiers and text for the category, event message, and parameter insertion strings. Specifically, the message defined for resource identifier 1004 uses a placeholder for a parameter string defined for resource identifier 5002.

```
```txt
; // EventLogMsgs.mc
; // ********************************************************

Expand Down
2 changes: 2 additions & 0 deletions xml/System.Diagnostics/ProcessStartInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ var info = new System.Diagnostics.ProcessStartInfo("cmd.exe")
Arguments = "/c dir \"C:\\Program Files\\dotnet\""
};
```

```vb
Dim info As New System.Diagnostics.ProcessStartInfo("cmd.exe")
info.ArgumentList.Add("/c")
Expand All @@ -347,6 +348,7 @@ info.ArgumentList.Add("C:\Program Files\dotnet")
' The corresponding assignment to the Arguments property is:
info.Arguments = "/c dir ""C:\Program Files\dotnet"""
```

]]></format>
</remarks>
</Docs>
Expand Down
12 changes: 6 additions & 6 deletions xml/System.Diagnostics/XmlWriterTraceListener.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ You can create an <xref:System.Diagnostics.XmlWriterTraceListener> in your code.
## Remarks
This constructor initializes the <xref:System.Diagnostics.TraceListener.Name%2A> property to the `name` parameter value or to an empty string ("") if the `name` parameter is `null`. The name can be used as an index into the <xref:System.Diagnostics.Trace.Listeners%2A?displayProperty=nameWithType> collection to programmatically change the properties for the listener. For example, the following code sets the <xref:System.Diagnostics.TraceListener.TraceOutputOptions%2A> property for an instance of <xref:System.Diagnostics.XmlWriterTraceListener> whose <xref:System.Diagnostics.TraceListener.Name%2A> property is "xmlListener".

```
```csharp
((XmlWriterTraceListener)Trace.Listeners["xmlListener"]).TraceOutputOptions =
TraceOptions.Timestamp
TraceOptions.Timestamp;
```

]]></format>
Expand Down Expand Up @@ -357,9 +357,9 @@ You can create an <xref:System.Diagnostics.XmlWriterTraceListener> in your code.
## Remarks
This constructor initializes the <xref:System.Diagnostics.TraceListener.Name%2A> property to the `name` parameter value or to an empty string ("") if the `name` parameter is `null`. The name can be used as an index into the <xref:System.Diagnostics.Trace.Listeners%2A?displayProperty=nameWithType> collection to programmatically change the properties for the listener. For example, the following code sets the <xref:System.Diagnostics.TraceListener.TraceOutputOptions%2A> property for an instance of <xref:System.Diagnostics.XmlWriterTraceListener> whose <xref:System.Diagnostics.TraceListener.Name%2A> property is "xmlListener".

```
```csharp
((XmlWriterTraceListener)Trace.Listeners["xmlListener"]).TraceOutputOptions =
TraceOptions.Timestamp.
TraceOptions.Timestamp;
```

]]></format>
Expand Down Expand Up @@ -412,9 +412,9 @@ You can create an <xref:System.Diagnostics.XmlWriterTraceListener> in your code.

The <xref:System.Diagnostics.TraceListener.Name%2A> property is set to the `name` parameter value or to an empty string ("") if the `name` parameter is `null`. The name can be used as an index into the <xref:System.Diagnostics.Trace.Listeners%2A?displayProperty=nameWithType> collection to programmatically change the properties for the listener. For example, the following code sets the <xref:System.Diagnostics.TraceListener.TraceOutputOptions%2A> property for an instance of <xref:System.Diagnostics.XmlWriterTraceListener> whose <xref:System.Diagnostics.TraceListener.Name%2A> property is "xmlListener".

```
```csharp
((XmlWriterTraceListener)Trace.Listeners["xmlListener"]).TraceOutputOptions =
TraceOptions.Timestamp.
TraceOptions.Timestamp;
```

]]></format>
Expand Down