Repros the Azure Functions throw TaskCanceledException #5216 when reading from a Service Bus Queue from an Azure Function
This sample writes to a Service Bus Queue via a Timer Trigger and reads from the queue via a Queue Trigger.
Also included is a createResourceGroup.sh
shell script that will create the Azure Service Bus to write/read from.
This successfully reproduces the TaskCanceledException for me. See ReadMe for more info. You will need to add your own localsettings.json
file to add a reference to the ServiceBusConnectionString
generated by the script.
This sample will cause the following Exception to be thrown on every ReadQueueFunction invocation.
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll: 'A task was canceled.'
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.MetricsEventManager.FunctionActivityTracker.<<-ctor>b__10_0>d.MoveNext() in C:\azure-functions-host\src\WebJobs.Script.WebHost\Diagnostics\MetricsEventManager.cs:line 363
az login
to your Azure Subscription- Execute
.\createResourceGroup.sh
to build Azure Resource Group - Update your
local.settings.json
with the connection string returned from script - Open in Visual Studio and Run
- Azure Functions Runtime
func -v
returns3.0.2009
- Visual Studio
16.5.0 Preview 1.0
- Implemented this workaround Debug startup fails "no Function runtime available" #5145
Source for MetricsEventManager.cs specifically these lines specifically eat the exception.
Thus, this may be the expected behavior. The exceptions are noted in the debugger, but exection continues, no harm, no foul.