Table of Contents

Class ConsoleMessageBuilder

Namespace
RDCore.SDK.ConsoleIO
Assembly
RDCore.SDK.dll

An immutable builder for a structured console message. Each With* call returns a new instance; a renderer consumes Parts and Kind. At most one part of each MessagePart role is kept (last write wins is not applied — the first is kept).

public record ConsoleMessageBuilder : IEquatable<ConsoleMessageBuilder>
Inheritance
ConsoleMessageBuilder
Implements
Inherited Members

Properties

Body

The body part's text, or Empty.

public string Body { get; }

Property Value

string

IsWithLineBreak

Whether the renderer should emit a trailing blank line after this message.

public bool IsWithLineBreak { get; init; }

Property Value

bool

Kind

The message severity / intent.

public MessageKind Kind { get; init; }

Property Value

MessageKind

Parts

The parts that make up the message.

public ImmutableArray<ConsoleMessagePart> Parts { get; init; }

Property Value

ImmutableArray<ConsoleMessagePart>

StackTrace

The stack-trace part's text, or Empty.

public string StackTrace { get; }

Property Value

string

Title

The title part's text, or Empty.

public string Title { get; }

Property Value

string

Verbose

The verbose part's text, or Empty.

public string Verbose { get; }

Property Value

string

Methods

WithKind(MessageKind)

Sets the message MessageKind.

public ConsoleMessageBuilder WithKind(MessageKind kind)

Parameters

kind MessageKind

Returns

ConsoleMessageBuilder

WithLineBreak(bool)

Requests a trailing blank line after the message.

public ConsoleMessageBuilder WithLineBreak(bool withLineBreak = true)

Parameters

withLineBreak bool

Returns

ConsoleMessageBuilder

WithMessageBody(VBErrorInfo)

Adds a body part from an error's description.

public ConsoleMessageBuilder WithMessageBody(VBErrorInfo error)

Parameters

error VBErrorInfo

Returns

ConsoleMessageBuilder

WithMessageBody(Exception)

Adds a body part from an exception's message.

public ConsoleMessageBuilder WithMessageBody(Exception exception)

Parameters

exception Exception

Returns

ConsoleMessageBuilder

WithMessageBody(string)

Adds a body part from literal text.

public ConsoleMessageBuilder WithMessageBody(string body)

Parameters

body string

Returns

ConsoleMessageBuilder

WithPart(ConsoleMessagePart)

Adds an arbitrary part.

public ConsoleMessageBuilder WithPart(ConsoleMessagePart part)

Parameters

part ConsoleMessagePart

Returns

ConsoleMessageBuilder

WithPlaceholder(PlaceholderKind, string, double)

Adds a numeric placeholder span, substituted where {$name} appears in the body.

public ConsoleMessageBuilder WithPlaceholder(PlaceholderKind kind, string placeholder, double value)

Parameters

kind PlaceholderKind
placeholder string
value double

Returns

ConsoleMessageBuilder

WithPlaceholder(string, string)

Adds a string placeholder span, substituted where {$name} appears in the body.

public ConsoleMessageBuilder WithPlaceholder(string placeholder, string value)

Parameters

placeholder string
value string

Returns

ConsoleMessageBuilder

WithStackTrace(Exception)

Adds a stack-trace part for an exception.

public ConsoleMessageBuilder WithStackTrace(Exception exception)

Parameters

exception Exception

Returns

ConsoleMessageBuilder

WithTimestamp(DateTimeOffset)

Adds a timestamp part.

public ConsoleMessageBuilder WithTimestamp(DateTimeOffset timestamp)

Parameters

timestamp DateTimeOffset

Returns

ConsoleMessageBuilder

WithTitle(VBApplicationErrorInfo)

Adds a title part from an application error's diagnostic code.

public ConsoleMessageBuilder WithTitle(VBApplicationErrorInfo error)

Parameters

error VBApplicationErrorInfo

Returns

ConsoleMessageBuilder

WithTitle(VBCompileErrorInfo)

Adds a title part from a compile error's diagnostic code.

public ConsoleMessageBuilder WithTitle(VBCompileErrorInfo error)

Parameters

error VBCompileErrorInfo

Returns

ConsoleMessageBuilder

WithTitle(VBRuntimeErrorInfo)

Adds a title part from a runtime error's diagnostic code.

public ConsoleMessageBuilder WithTitle(VBRuntimeErrorInfo error)

Parameters

error VBRuntimeErrorInfo

Returns

ConsoleMessageBuilder

WithTitle(VBSyntaxErrorInfo)

Adds a title part from a syntax error's diagnostic code.

public ConsoleMessageBuilder WithTitle(VBSyntaxErrorInfo error)

Parameters

error VBSyntaxErrorInfo

Returns

ConsoleMessageBuilder

WithTitle(Exception)

Adds a title part from an exception's type name.

public ConsoleMessageBuilder WithTitle(Exception exception)

Parameters

exception Exception

Returns

ConsoleMessageBuilder

WithTitle(string)

Adds a title part from literal text.

public ConsoleMessageBuilder WithTitle(string title)

Parameters

title string

Returns

ConsoleMessageBuilder

WithVerbose(VBErrorInfo)

Adds a verbose-detail part from an error's verbose text.

public ConsoleMessageBuilder WithVerbose(VBErrorInfo error)

Parameters

error VBErrorInfo

Returns

ConsoleMessageBuilder

WithVerbose(string)

Adds a verbose-detail part from literal text.

public ConsoleMessageBuilder WithVerbose(string verbose)

Parameters

verbose string

Returns

ConsoleMessageBuilder