Table of Contents

Class CStructConstraintException

Namespace
CStructSharp.Diagnostics
Assembly
CStructSharp.dll

Represents a read that stopped because a field's value did not satisfy an @expect or @supports constraint of the layout. It is a CStructReadException with the code ReadFailed; Kind says whether the data is malformed or merely unsupported.

public sealed class CStructConstraintException : CStructReadException, ISerializable
Inheritance
CStructConstraintException
Implements
Inherited Members

Constructors

CStructConstraintException(ConstraintKind, string, string, string?, string?)

Creates a constraint failure.

public CStructConstraintException(ConstraintKind kind, string constraint, string message, string? label = null, string? description = null)

Parameters

kind ConstraintKind

Whether the value is invalid or the layout does not support it.

constraint string

The condition as written in the layout.

message string

The diagnostic naming the field and the condition.

label string

The label the layout gave the constraint, or null when it has none.

description string

The message the layout gave the constraint, or null when it has none; see Description.

Properties

Constraint

Gets the condition that was not satisfied, as written in the layout.

public string Constraint { get; }

Property Value

string

Description

Gets the message the layout gave the constraint (@expect(magic == 0xEF53, "ext.magic", "Not an ext superblock")); null when the constraint has none. When present it replaces the generated sentence in Message, which then still ends with the position facts and the Label in brackets.

public string? Description { get; }

Property Value

string

Kind

Gets whether the data is malformed (@expect) or unsupported (@supports).

public ConstraintKind Kind { get; }

Property Value

ConstraintKind

Label

Gets the label the layout gave the constraint (@expect(magic == 0xEF53, "ext.magic")), a stable name or wording a caller can match instead of the message; null when the constraint has none.

public string? Label { get; }

Property Value

string

Message

Gets the diagnostic naming the field and the condition (or the layout's own message), with the position facts a failure carries.

public override string Message { get; }

Property Value

string