Table of Contents

YamlSerializationException Class

Definition

Namespace
Bodu.Text.Yaml
Assembly
Bodu.Text.Yaml.dll
Package
Bodu.Text.Yaml 1.0.0
Source
SerializationException.cs

The exception thrown when a value cannot be bound to or from a YAML document during serialization - for example a type mismatch, a missing required member, or a value YAML cannot represent.

public sealed class YamlSerializationException : Exception, ISerializable
Inheritance
YamlSerializationException
Implements
Inherited Members
Extension Methods

Remarks

This exception reports a binding-level failure and is distinct from YamlFormatException, which reports that the source text was not well-formed YAML. When the failure can be traced to a member, the Path carries the dotted path to it; when it can be traced to a position in the source, the Offset, LineNumber, and ColumnNumber carry the position.

Constructors

YamlSerializationException()

Initializes a new instance of the YamlSerializationException class.

public YamlSerializationException()

YamlSerializationException(string)

Initializes a new instance of the YamlSerializationException class with the specified message.

public YamlSerializationException(string message)

Parameters

message string

The message that describes the error.

YamlSerializationException(string, Exception?)

Initializes a new instance of the YamlSerializationException class with the specified message and a reference to the inner exception that caused it.

public YamlSerializationException(string message, Exception? innerException)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that caused the current exception.

YamlSerializationException(string, int)

Initializes a new instance of the YamlSerializationException class with the specified message and source offset.

public YamlSerializationException(string message, int offset)

Parameters

message string

The message that describes the error.

offset int

The byte offset into the source at which the error was detected.

Properties

ColumnNumber

Gets the 1-based column number, in UTF-8 bytes from the start of the line, at which the error was detected, when available.

public int? ColumnNumber { get; }

Property Value

int?

The column number, or null when the failure has no associated position.

LineNumber

Gets the 1-based line number in the source at which the error was detected, when available.

public int? LineNumber { get; }

Property Value

int?

The line number, or null when the failure has no associated position.

Offset

Gets the byte offset into the source at which the error was detected, when available.

public int? Offset { get; }

Property Value

int?

The byte offset, or null when the failure has no associated position.

Path

Gets the dotted path to the member whose binding failed, for example server.endpoints[0].timeout, when available.

public string? Path { get; }

Property Value

string

The member path, or null when the failure is not associated with a member.

Applies to

ProductVersions
.NET8, 10