[BUG] Service Bus raises an incorrect exception for legal values of ForwardTo
See original GitHub issueDescribe the bug Receiving an erroneous error “{0} exceeds the ‘260’ character limit. (Parameter ‘ForwardTo’)” when setting ForwardTo to a value less than 260 characters, but which would exceed it when the base path is prepended.
Expected behavior The maximum name supported is 260 characters, but that should exclude the base path.
Actual behavior (include Exception or Stack Trace) Microsoft.Azure.ServiceBus.ServiceBusException: ‘Entity path ‘sb://sanitized-base-east-us-sanitized.servicebus.windows.net/integration-test-pc-name-lt-azureservicebusamqpconnection-sanitized.messagequeue.client.tests.integration.chain.provisionflowconsumer-sanitized.messagequeue.client.tests.integration.chain.request.sqlservermessage’ exceeds the ‘260’ character limit. (Parameter ‘ForwardTo’)’
In this situation, the base path is appended by the framework by the following code located in SubscriptionDescriptionExtensions.cs
description.ForwardTo = NormalizeForwardToAddress(description.ForwardTo, baseAddress);
The setter of ForwardTo then runs validation which causes the exception to be thrown.
To Reproduce
var description = new SubscriptionDescription(topicName, subscriptionName)
{
ForwardTo = queueName,
// where queuename is less than 260 characters EXCLUDING the base address
// sanitized code
};
if (await _managementClient.SubscriptionExistsAsync(description.TopicPath, description.SubscriptionName))
{
// sanitized code
}
Environment: Microsoft.Azure.ServiceBus v4.1.2
.NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961
Runtime Environment: OS Name: Windows OS Version: 10.0.18362 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support): Version: 3.1.1 Commit: a1388f194c
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
ForwardDeadLetterTo
should also have been updated. Forgot about that. And also, this needs to be updated inQueeuDescription
as wel.@redtaped , thank you for getting back with another PR. Really appreciate it!