Property Checkpoint
Checkpoint
Gets or sets a callback invoked at block, table-row, page and section boundaries during layout. Throwing from it aborts the layout; returning normally continues it.
public Action? Checkpoint { get; set; }
Property Value
Remarks
Why a callback rather than a token and a deadline. Layout is the longest
stage of a conversion and was the only one that could not be interrupted: the facade
observed cancellation and ResourceLimits.MaxWallClockTime between stages, so a
document that spent minutes inside a single Layout(ResolvedDocument, IConversionDiagnostics?) call ran to
completion whatever the caller had asked for — which made MaxWallClockTime mean
"checked between stages" while its documentation said "maximum conversion time".
Both of those are the caller's concepts, not layout's, and the wall-clock budget in particular is measured from the start of the conversion rather than of the layout. Handing the engine one hook it periodically calls keeps that knowledge with the facade, which already has it, instead of teaching the layout engine to track elapsed time it has no way to measure correctly.
The hook is called often enough to be responsive and rarely enough to be free: at boundaries between units of work, never inside a measurement.