When NServiceBus v9.1.0 attempts to process message payloads containing multiple logical messages, an exception is thrown:
System.ArgumentException: An item with the same key has already been added. Key: nservicebus.message_handler_types
Who's affected
You are affected if you use legacy versions of NServiceBus (v5 or prior) that communicate with NServiceBus endpoints with version 9.1.0 and send multiple logical messages in a single payload.
Root cause
Previous versions of NServiceBus supported sending multiple logical messages per physical message. This resulted in an issue when collecting metric tags, which is resolved in this PR.
This issue also surfaced in ServiceControl when using the NServiceBus.Metrics.ServiceControl package as it batches multiple logical messages in the same physical message.
Symptoms
When NServiceBus v9.1.0 attempts to process message payloads containing multiple logical messages, an exception is thrown:
Who's affected
You are affected if you use legacy versions of NServiceBus (v5 or prior) that communicate with NServiceBus endpoints with version 9.1.0 and send multiple logical messages in a single payload.
Root cause
Previous versions of NServiceBus supported sending multiple logical messages per physical message. This resulted in an issue when collecting metric tags, which is resolved in this PR.
This issue also surfaced in ServiceControl when using the NServiceBus.Metrics.ServiceControl package as it batches multiple logical messages in the same physical message.
Backport of https://github.com/Particular/NServiceBus/pull/7129 to 9.1