How will injected dependency using options pattern for configuration
Have a v4 Azure function Im starting. I want to create a service class and inject it at startup so I can use it via my function. Im reading my configuration values into objects using the Options pattern, as seen in the docs. How can I get this options object injected into the service class constructor?
Class names like ‘Workflows’ or ‘WorkflowTemplates’ not exposed
I’m encountering an issue in Azure Functions where class names like Workflows or WorkflowTemplates seem to be causing problems. Specifically, functions within these classes are not being exposed or recognized by Azure Functions. However, when I move these functions to a different class, they work as expected.
Azure Functions: Class names like ‘Workflows’ or ‘WorkflowTemplates’ not exposed
I’m encountering an issue in Azure Functions where class names like Workflows or WorkflowTemplates seem to be causing problems. Specifically, functions within these classes are not being exposed or recognized by Azure Functions. However, when I move these functions to a different class, they work as expected.
.NET 8 azure function.ConfigureFunctionsWebApplication() and Synchronous operations are disallowed
For few months now I deploy .NET 8 azure function project with no issues.
Today it errored on any deployment attempt and I notice the error in program.cs that .ConfigureFunctionsWorkerDefaults()
should be .ConfigureFunctionsWebApplication()
see here.
after changing, all my responses started erroring with:
System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.Write
I found some ways to set AllowSynchronousIO to true but they relate to Core 3 or 6. Nothing about .NET 8
I know I could change to await response.WriteAsJsonAsync(
but then I will have to change all the consumers of the APIs and it is a lot to change.