Skip to content
Start free evaluation

PDComm.Modbus.ModbusCommandException

Class

The exception thrown when a Modbus endpoint rejects a command (native status SERVICE_ERROR).

public sealed class ModbusCommandException : InvalidOperationException

It derives from InvalidOperationException, so existing handlers keep working. The message is the endpoint's English error text; base decisions on ModbusCommandException.Code, not on the wording.

Members

Code

Property

Gets the machine-readable error code, or null for errors without one. Codes: license_required (a connect refused without a valid license for modbus, or for modbus-security when security is configured), license_invalid (a license_install without a verifiable license) and host_id_unavailable.

public string? Code { get; }

Details

Property

Gets the license object of a license_required reply, with the refused module, its license state (for example missing or expired) and the deciding license_id; otherwise null.

public JsonElement? Details { get; }

LicenseRequired

Property

Gets whether the command was refused for lack of a PDComm license (ModbusCommandException.Code is license_required). Connections that are already open are not affected.

public bool LicenseRequired { get; }