Skip to content

MQTT-Driver runs into InvalidOperationException on start-up when broker is unavailable #1048

@1nf0rmagician

Description

@1nf0rmagician

Describe the bug
When starting a application with a configured MQTT-Driver and an MQTT-JsonTopic we run into the following error

warn: Moryx.Resources.Management.Mqtt Driver[0]
Failed to connect to broker
System.InvalidOperationException: The state with the name 'ConnectedToBrokerState' cannot handle the method 'TriedConnecting'.
at Moryx.StateMachines.StateBase.InvalidState(String methodName)
at Moryx.Drivers.Mqtt.States.DriverMqttState.TriedConnecting(Boolean successful)
at Moryx.Drivers.Mqtt.States.ConnectedToBrokerState.TriedConnecting(Boolean successful)
at Moryx.Drivers.Mqtt.MqttDriver.Connect(Boolean firstConnect)
at Moryx.Drivers.Mqtt.MqttDriver.b__104_0()
info: Moryx.Resources.Management.Mqtt Driver[0]
Subscribing to topic *************
fail: Moryx.Resources.Management.Mqtt Driver[0]
Exception during ParallelOperations of MqttDriver.b__96_0!
System.NullReferenceException: Object reference not set to an instance of an object.
at Moryx.Drivers.Mqtt.MqttTopic.Matches(String receivedTopic)
at Moryx.Drivers.Mqtt.MqttDriver.<>c__DisplayClass97_0.b__0(MqttTopic t)
at System.Linq.Enumerable.IEnumerableWhereIterator1.ToList() at Moryx.Drivers.Mqtt.MqttDriver.Receive(MqttApplicationMessage appMessage) at Moryx.Drivers.Mqtt.MqttDriver.<OnReceived>b__96_0(<>f__AnonymousType01 param)
at Moryx.Threading.ParallelOperations.<>c__DisplayClass9_0`1.b__0(Object state)

Environment:
MORYX 10.1.0

Affected components/modules
MORYX-MQTT-Driver

Reproducibility
Issue only occurs when the broker is not available during start-up

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions