TraceListener.Fail Method

Definition

Emits error messages to the listener you create when you implement the TraceListener class.

Overloads

Fail(String)

Emits an error message to the listener you create when you implement the TraceListener class.

Fail(String, String)

Emits an error message and a detailed error message to the listener you create when you implement the TraceListener class.

Fail(String)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

Emits an error message to the listener you create when you implement the TraceListener class.

C#
public virtual void Fail(string? message);
C#
public virtual void Fail(string message);

Parameters

message
String

A message to emit.

Remarks

The default behavior is to display the specified message in a message box when the application is running in a user-interface mode, and to the TraceListener instances in a TraceListenerCollection collection. By default, the TraceListenerCollection collection has an instance of a DefaultTraceListener. You can customize this behavior by adding a TraceListener to or removing one from the collection.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Fail(String, String)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

Emits an error message and a detailed error message to the listener you create when you implement the TraceListener class.

C#
public virtual void Fail(string? message, string? detailMessage);
C#
public virtual void Fail(string message, string detailMessage);

Parameters

message
String

A message to emit.

detailMessage
String

A detailed message to emit.

Remarks

The default behavior is to display the message and detailed message in a message box when the application is running in a user-interface mode, and to the TraceListener instances in a TraceListenerCollection collection. By default, the TraceListenerCollection collection has an instance of a DefaultTraceListener. You can customize this behavior by adding a TraceListener to or removing one from the collection.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1