Azure/azure-functions-dotnet-worker

When to use IAutoConfigureStartup vs WorkerExtensionStartup?

swettstein opened this issue · 2 comments

What version of .NET does your existing project use?

.NET 6

What version of .NET are you attempting to target?

.NET 6

Description

I am working on migrating an extension library from In-Process to Isolated that will automatically register services and middleware for my users. I started using WorkerExtensionStartup to replace IWebJobsStartup but then I discovered IAutoConfigureStartup. What is the difference between WorkerExtensionStartup and IAutoConfigureStartup and when should I use each of them?

Project configuration and dependencies

Microsoft.Azure.Functions.Worker 1.22.0
Microsoft.Azure.Functions.Worker.Sdk 1.17.2
Microsoft.Azure.Functions.Worker.Extensions.Timer 4.3.0
Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore 1.3.1

Link to a repository that reproduces the issue

No response

IAutoConfigureStartup: For function app directly. Only the entry assembly is scanned for this, so it is for the function app directly and not extensions. Uses reflection.
WorkerExtensionStartup: For extensions. All loaded assemblies are scanned for this (at compile time via a source generator).

I'll bring this up for discussion with our team as this is confusing and we can revisit this design as part of a major version breaking change.

got it. that was my experience when playing around with them but was looking for clarification.