I'm experimenting with extensions in Azure Functions as shown in this question but can't get it to work.
My code looks like this: (pre-compiled, consumption plan)
public static class FirstFunction
{
[FunctionName("FirstFunction"),]
public static void Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true)]TimerInfo myTimer, TraceWriter log)
{
log.Info($"Started = { TestExtension.Started }");
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
public class TestExtension : IExtensionConfigProvider
{
public static bool Started = false;
public void Initialize(ExtensionConfigContext context) {
Started = true;
Console.WriteLine("TestExtensionConsole");
context.Trace.Error("TestExtension");
throw new Exception("TextExtensionException");
}
}
But nothing happens at runtime. I see the log from the timer Started = false
but nothing else.
Do I need to enable extensions or something?