Enum ConstraintFailureMode
- Namespace
- CStructSharp
- Assembly
- CStructSharp.dll
Chooses the exception type a generated reader throws for a field that breaks an @expect or @supports
constraint. It is the ConstraintFailures option (project default: the build property
CStructSharpConstraintFailures).
public enum ConstraintFailureMode
Fields
Constraint = 0A failed constraint throws CStructConstraintException, as the runtime does.
FormatExceptions = 1A failed
@expectthrows InvalidDataException and a failed@supportsthrows NotSupportedException. The message is the constraint failure's, and the CStructConstraintException is the inner exception, so its label, kind, member, path and offset stay available.
Remarks
The mode applies to the generated Parse methods of every input kind, the sequence and stream readers, the record
enumerators and a view's Validate. The non-throwing forms (TryParse, TryValidate, Matches) and
the violations a read collects are failure values and do not change. A layout read through the runtime engine
(CStruct.Parse) or the browser engine always throws CStructConstraintException.