I'm using .NET 5.0, Azure runtime 3.
I have an Azure function that triggers based on a service bus. The function declaration looks like:
[FixedDelayRetry(0, "00:00:00")]
[Function("MyFunkyFunc")]
public async Task Run(
[ServiceBusTrigger("myqueuenname", Connection = "MyQueueConnection")] string myQueueItem,
FunctionContext context)
{
...
}
From Visual Studio when I debug I receive the following message(s):
Azure Functions Core Tools
Core Tools Version: 3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206(64-bit)
Function Runtime Version: 3.3.1.0
[2021-11-29T20:42:11.704Z] A host error has occurred during startup operation '8cc138c0-e49a-4acb-a10e-60648d4548ad'.
[2021-11-29T20:42:11.705Z] Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'MyQueueConnection' is missing or empty.
Value cannot be null. (Parameter 'provider')
Press any to continue....
The "a host error" and "connect string missing" messages repeat over and over. If I press enter the run ends.
HOWEVER... my Program.Main method is not invoked. It's in there where I initialize DI etc and do a "builder.AddUserSecrets();" so my connection string will be loaded from user secrets.
My Program.Main is not invoked prior to these errors. Which seems backwards, very backwards. My function has a few dependencies that are provided by DI so part of the runtime is trying to connect to the service bus before it could possible even create an instance of the receiving function.
Does the azure function debugging thingy just not work with Program.Main?
How can I tell the azure function debugging thingy to use UserSecrets?
Thanks!!