question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] MessageToPocoConverter overrides any custom ServiceBusReceivedMessage open converters

See original GitHub issue

Library name and version

Microsoft.Azure.WebJobs.Extensions.ServiceBus 5.7.0

Describe the bug

Hey,

As in title, I’m trying to add my custom open converter for ServiceBusReceivedMessage:

...
context.AddOpenConverter<ServiceBusReceivedMessage, MessageEnvelope<OpenType>>(typeof(GenericMessageEnvelopeConverter<>));
...

also tried with OpenType.Poco

...
context.AddOpenConverter<ServiceBusReceivedMessage, MessageEnvelope<OpenType.Poco>>(typeof(GenericMessageEnvelopeConverter<>));
...

Here is my open converter:

internal class GenericMessageEnvelopeConverter<T> : IConverter<ServiceBusReceivedMessage, MessageEnvelope<T>>

Expected behavior

My custom open converter is called instead of MessageToPocoConverter.

Actual behavior

Every time when queue triggers:

 [FunctionName(nameof(ServiceBusStart))]
        public async Task ServiceBusStart(
            [ServiceBusTrigger("%queueName%", Connection = "SbConnString")] MessageEnvelope<MyCustomType> msg,
            [DurableClient] IDurableOrchestrationClient starter)

it calls MessageToPocoConverter - which is added in ServiceBusExtensionProvider - well I am not 100% it calls MessageToPocoConverter, but I get this error when using MessageEnvelope without parameterless constructor .

I believe that I’ve wired up everything correctly since when I change my custom converter from open to regular one:

...
context.AddConverter<ServiceBusReceivedMessage, int>(new GenericMessageEnvelopeConverter());
...

the converter is called as expected

Reproduction Steps

Create custom ServiceBusReceivedMessage open converter and trigger it with message.

Environment

local machine Windows 10, netcoreapp3.1, VS 2022

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JoshLove-msftcommented, Oct 11, 2022
1reaction
jsquirecommented, Oct 6, 2022

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] MessageToPocoConverter overrides any custom ...
As in title, I'm trying to add my custom open converter for ServiceBusReceivedMessage : ... context.AddOpenConverter<ServiceBusReceivedMessage, ...
Read more >
Chapter 9. Azure ServiceBus
(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. (consumer) Gets the scheduled enqueue time of ......
Read more >
Deep dive into Azure Service Bus messaging with the .NET ...
And if you also want to like, for example, override some of the system properties that are called, we can, for example, control...
Read more >
azure-sdk-for-net
[BUG] MessageToPocoConverter overrides any custom ServiceBusReceivedMessage open converters. coolhome. coolhome CLOSED · Updated 2 months ago ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found