Class SnapshotException
- Namespace
- SnapshotAssertions
- Assembly
- SnapshotAssertions.dll
Exception thrown by snapshot-assertion entry points when a comparison fails (mismatch or missing baseline). Carries the underlying SnapshotResult for programmatic access; the Message is the same human-readable form rendered by Describe().
public sealed class SnapshotException : Exception, ISerializable
- Inheritance
-
SnapshotException
- Implements
- Inherited Members
Remarks
Not marked [Serializable]: legacy BinaryFormatter serialization is deprecated
since .NET 5 and unsupported in modern .NET; cross-AppDomain transfer of the underlying
SnapshotResult is not a supported scenario for this exception.
Constructors
SnapshotException()
Initialises an exception with no result. Provided for the .NET exception constructor pattern (CA1032); production code should use SnapshotException(SnapshotResult).
public SnapshotException()
SnapshotException(SnapshotResult)
Initialises an exception describing a failed snapshot comparison.
public SnapshotException(SnapshotResult result)
Parameters
resultSnapshotResultThe failed comparison result. Must not be a passing outcome.
Exceptions
- ArgumentNullException
resultis null.- ArgumentException
resultrepresents a passing outcome; only failing outcomes warrant an exception.
SnapshotException(string)
Initialises an exception with a custom message. Provided for the .NET exception constructor pattern (CA1032); production code should use SnapshotException(SnapshotResult) instead.
public SnapshotException(string message)
Parameters
messagestringThe human-readable failure message.
SnapshotException(string, Exception)
Initialises an exception with a custom message and inner exception. Provided for the .NET exception constructor pattern (CA1032); production code should use SnapshotException(SnapshotResult) instead.
public SnapshotException(string message, Exception innerException)
Parameters
Properties
Result
The result that triggered the exception, when constructed via SnapshotException(SnapshotResult); otherwise null.
public SnapshotResult? Result { get; }