Friday, September 20, 2019

C# Azure WebJobs - Functions Ending with Async Don't Run

While trying to debug some new WebJobs that were running, I decided to implement the process of elimination to see what made certain job definitions not run. Here is the method, that would not run.

public static void PurgeOldRecordsAsync([TimerTrigger("0 * * * * *")] TimerInfo timerInfo, ILogger log)
     await helper.RunTaskAsync(); 

In the process of elimination, I simplified the function content to just print to the log when it ran. Also, I tried replacing the async Task portion the function with a void return. Neither changed anything. Then I tried changing the name of the function to TestJob and it ran. So I determined it had something to do with the name...

It turns out that any function name ending in Async wouldn't run. Once I removed this from the function name, the job triggered as expected.

I searched the web, but couldn't find a reason for this. If you know, please share in the comments.

No comments: