Skip to content

Property Critical

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

Critical

Gets or sets a value indicating whether gets or sets whether this teardown method is critical and must execute even in emergency disconnection scenarios.

csharp
public bool Critical { get; set; }

Property Value

bool

Examples

[Teardown(Critical = true)]
private async Task EmergencyShutdownAsync()
{
    // Always execute, even in emergency disconnect
    await ExecuteAsync(@"
        # Critical safety shutdown
        try:
            emergency_stop()
            disable_all_power()
        except:
            pass  # Must not throw in critical teardown
    ");
}

Remarks

Critical teardown operations are executed even when the disconnection is forced due to timeouts, errors, or emergency shutdown. Use this flag only for operations that are essential for safety or data integrity.

Critical operations should be very fast and robust, as they may execute in adverse conditions where normal communication is already compromised.

Released under the Apache License 2.0.