"Can not start an Activity that was already started" in BaseProducer
gius opened this issue · 0 comments
Describe the bug
When producing an event, System.InvalidOperationException: '"Can not start an Activity that was already started"'
is thrown (and immediately swallowed) by System.Diagnostics.DiagnosticSource.dll!System.Diagnostics.Activity.NotifyError(System.Exception exception)
.
The reason is that in BaseProducer.Produce, we explicitly call act?.Start()
, but the activity has already been started by the previous line's call to ProducerActivity.Start.
eventuous/src/Core/src/Eventuous.Producers/BaseProducer.cs
Lines 46 to 47 in b72c9c0
To Reproduce
Steps to reproduce the behavior:
- Enable Break When Thrown for
System.InvalidOperationException
in Visual Studio's Exception Settings - Publish an event through
RabbitMqProducer
- See error
Expected behavior
No exception should be thrown.
I can provide a PR if you want. As far as I can understand, simply changing
toreturn (act, new[] { producedMessage });
should be enough.