Table of Contents

TomlSerializationException Class

Definition

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

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

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

Remarks

This exception reports a binding-level failure and is distinct from TomlFormatException, which reports that the source text was not well-formed TOML. 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

TomlSerializationException()

Initializes a new instance of the TomlSerializationException class.

public TomlSerializationException()

TomlSerializationException(string)

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

public TomlSerializationException(string message)

Parameters

message string

The message that describes the error.

TomlSerializationException(string, Exception?)

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

public TomlSerializationException(string message, Exception? innerException)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that caused the current exception.

TomlSerializationException(string, int)

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

public TomlSerializationException(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