Skip to content

Modbus tcp server/slave unable to use slaveID other than default #154

@smk422

Description

@smk422

start a modbus tcp server listening with a slaveID = 1, 2, 3 or other. According to Copilot, this is a bug.

Exception has occurred: CLR/System.Collections.Generic.KeyNotFoundException
An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in System.Private.CoreLib.dll: 'No unit found for the specified unit identifier.'
at FluentModbus.ModbusServer.Find(Byte unitIdentifier, Dictionary2 map) at FluentModbus.ModbusServer.GetHoldingRegisterBuffer(Byte unitIdentifier) at FluentModbus.ModbusServer.GetHoldingRegisterBuffer[T](Byte unitIdentifier) at ScadaPlus.Integration.Modbus.ModbusSlave.EnsureUnitInitialized(Byte unitId) in c:\develop\sp-edge-integration-server\ScadaPlus.Integration.Modbus\ModbusSlave.cs:line 74 at ScadaPlus.Integration.Modbus.ModbusSlave.startServer() in c:\develop\sp-edge-integration-server\ScadaPlus.Integration.Modbus\ModbusSlave.cs:line 48 at ScadaPlus.Integration.Modbus.Slave.Collector.<ExecuteAsync>d__7.MoveNext() in c:\develop\sp-edge-integration-server\Scada.Integration.Modbus.Slave\Collector.cs:line 57 at Microsoft.Extensions.Hosting.Internal.Host.<<StartAsync>b__15_1>d.MoveNext() at Microsoft.Extensions.Hosting.Internal.Host.<ForeachService>d__181.MoveNext()
at Microsoft.Extensions.Hosting.Internal.Host.d__15.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at ScadaPlus.Integration.Modbus.Slave.Program.Main(String[] args) in c:\develop\sp-edge-integration-server\Scada.Integration.Modbus.Slave\Program.cs:line 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions