Azure / Azure/azure-functions-dotnet-worker
ServiceBusOutput binding not working in .NET 8 isolated Azure Function, but manual send works
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
### Description
### Library name and version
Microsoft.Azure.Functions.Worker.Extensions.ServiceBus 5.23.0
### Describe the bug
ServiceBusOutput binding not working in .NET 8 isolated Azure Function, but manual send works and locally it also works:
When deployed to Azure:
### Expected behavior
ServiceBusOutput will work in .NET 8 isolated Azure Function
### Actual behavior
ServiceBusOutput does not send message to Service Bus Queue, however sending from ServiceBusClient works
### Environment
Azure Functions
Rider 2025, Windows 11
App settings:
```js
[
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
},
{
"name": "ServiceBusConnection__fullyQualifiedNamespace",
"value": "sbname.servicebus.windows.net",
"slotSetting": false
},
{
"name": "ServiceBusQueueName",
"value": "funcqueue",
"slotSetting": false
},
{
"name": "WEBSITE_ENABLE_SYNC_UPDATE_SITE",
"value": "true",
"slotSetting": false
},
{
"name": "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED",
"value": "1",
"slotSetting": false
}
]
```
### Steps to reproduce
### Reproduction Steps
```csharp
public class Response
{
[ServiceBusOutput("%ServiceBusQueueName%", Connection = "ServiceBusConnection")]
public string Test { get; set; }
public HttpResponseData HttpResponse { get; set; };
}
[Function("function")]
public async Task RunAsync([HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, FunctionContext context)
{
return new Response
{
Test = "test",
HttpResponse = req.CreateResponse(HttpStatusCode.Accepted)
};
}
```
There is no ServiceBus reference in Application Insights but my function failed :
```
net8.0
v4
Exe
enable
enable
...
```
However when i add that manual step in my function with `serviceBusClient` it can send message to queue:
```csharp
[Function("function")]
public async Task RunAsync([HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, FunctionContext context)
{
var d = new DefaultAzureCredential();
var serviceBusClient = new ServiceBusClient(Environment.GetEnvironmentVariable("ServiceBusConnection__fullyQualifiedNamespace"), d);
var sender = serviceBusClient.CreateSender(Environment.GetEnvironmentVariable("ServiceBusQueueName"));
await sender.SendMessageAsync(new ServiceBusMessage("{ test }"));
return new Response
{
Test = "test",
HttpResponse = req.CreateResponse(HttpStatusCode.Accepted)
};
}
```
And i can see that connection from App Insights:
Message `{ test }` appears in service bus (from `serviceBusClient`) but not one from `[ServiceBusOutput]` binding (`test`))
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided .NET 8 isolated reproduction, especially the Response type, RunAsync method, ServiceBusOutput attribute, package references, and deployed app settings. Compare the binding behavior and Application Insights output with the manual ServiceBusClient send. Done means the deployed function sends the output-bound test message to the configured Service Bus queue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100