Skip to content

Improper binding of MessageReceiver and Exception accessing Message properties #436

@PandaBoy00

Description

@PandaBoy00

Description

The parameter MessageReceiver Binding would be bind as string and not as Microsoft.Azure.ServiceBus.Core.MessageReceiver class. The Microsoft Doc states this parameter is a MessageReceiver class and not a System.String (https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=csharp)

After the execution of a ServiceBusTrigger in C#, the message parameter from Microsoft.Azure.ServiceBus.Message would bind. But trying to access any of message properties would result in exception and the message is "Operation is not valid due to the current state of the object"

All of these issue occurs in .Net 5.0 and using the package Microsoft.Azure.ServiceBus version 5.1.3. I'm using Visual Studio 2019 Version 16.10.2.

All of the issues listed is a non-issue if the project is compiled as a .Net Core 3.1.

Actual Behavior

  1. MessageReceiver bind as System.String in .Net 5.0 Project
  2. Message property would exception in .Net 5.0 Project

Expected Behavior

  1. MessageReceiver should bind as Microsoft.Azure.ServiceBus.Core.MessageReceiver class. This works fine in .Net Core 3.1 Project
  2. Message property access works fine in .Net Core 3.1 Project but exceptions in .Net 5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions