Skip to main content

Class PdfDiagnostics

Namespace: AdCodicem.Pdf.Diagnostics
Assembly: AdCodicem.Pdf.dll

Collects what the library noticed while working on a document.

public sealed class PdfDiagnostics : IReadOnlyList<PdfDiagnostic>, IReadOnlyCollection<PdfDiagnostic>, IEnumerable<PdfDiagnostic>, IEnumerable

Inheritance​

object ← PdfDiagnostics

Implements​

IReadOnlyList<PdfDiagnostic>, IReadOnlyCollection<PdfDiagnostic>, IEnumerable<PdfDiagnostic>, IEnumerable

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

Diagnostics are returned, not logged: they are part of the result, so they can be inspected, serialized and asserted on in tests. A malformed file that the reader repaired is a normal outcome, not an exception — but it is never a silent one.

Properties​

Capacity​

Gets the largest number of entries kept. A pathological file can produce an unbounded number of observations; beyond this limit they are counted but not stored.

public int Capacity { get; init; }

Property Value​

int

Count​

Gets the number of elements in the collection.

public int Count { get; }

Property Value​

int

HasConformanceLoss​

Gets a value indicating whether a conformance guarantee was lost.

public bool HasConformanceLoss { get; }

Property Value​

bool

HasRepairs​

Gets a value indicating whether the file needed repairing.

public bool HasRepairs { get; }

Property Value​

bool

HasWarnings​

Gets a value indicating whether anything worrying was observed.

public bool HasWarnings { get; }

Property Value​

bool

SuppressedCount​

Gets the number of entries dropped because PdfDiagnostics.Capacity was reached. A fault the reader meets again, as it parses an object again, is counted again once the capacity is reached, whether or not it was kept before.

public int SuppressedCount { get; }

Property Value​

int

this[int]​

Gets the element at the specified index in the read-only list.

public PdfDiagnostic this[int index] { get; }

Property Value​

PdfDiagnostic

Methods​

Add(PdfDiagnosticSeverity, string, string, long)​

Records an observation.

public void Add(PdfDiagnosticSeverity severity, string code, string message, long position = -1)

Parameters​

severity PdfDiagnosticSeverity

code string

message string

position long

Contains(string)​

Determines whether any entry carries the given code.

public bool Contains(string code)

Parameters​

code string

Returns​

bool

GetEnumerator()​

Returns a non-allocating enumerator over the entries.

public List<PdfDiagnostic>.Enumerator GetEnumerator()

Returns​

List<PdfDiagnostic>.Enumerator

Repair(string, string, long)​

Records a repair the reader performed.

public void Repair(string code, string message, long position = -1)

Parameters​

code string

message string

position long

Warn(string, string, long)​

Records a warning.

public void Warn(string code, string message, long position = -1)

Parameters​

code string

message string

position long