Repository navigation
publish: prerelease 1.0.1 - #2
Anders-Toegersen wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for the modern IFunctionsWorkerApplicationBuilder pattern introduced in Azure Functions Worker SDK, allowing users to use FunctionsApplication.CreateBuilder(args) instead of the legacy IHostBuilder pattern. The version is bumped from 1.0.0-prerelease to 1.0.1-prerelease. The PR also transitions sample projects from project references to package references.
Changes:
- Added
IFunctionsWorkerApplicationBuilderExtensions.UseDisabledWhen()extension method for the modern builder pattern - Updated source generator to support intercepting calls to both
IHostBuilder.UseDisabledWhen()andIFunctionsWorkerApplicationBuilder.UseDisabledWhen() - Added comprehensive test coverage for the new builder pattern in both reflection-based and source-generated test projects
- Updated README documentation to show both the modern and legacy builder patterns
- Converted sample projects from ProjectReference to PackageReference
- Added GitHub branch protection ruleset for the publish branch
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.props | Bumped version from 1.0.0 to 1.0.1-prerelease |
| src/AzureFunctions.DisabledWhen/IFunctionsWorkerApplicationBuilderExtensions.cs | New extension method for IFunctionsWorkerApplicationBuilder pattern |
| src/AzureFunctions.DisabledWhen.SourceGenerator/Internal/InterceptorInfo.cs | Added BuilderType enum and property to track which builder pattern is being intercepted |
| src/AzureFunctions.DisabledWhen.SourceGenerator/Internal/Emitter.cs | Updated to generate interceptor methods for both IHostBuilder and IFunctionsWorkerApplicationBuilder |
| src/AzureFunctions.DisabledWhen.SourceGenerator/DisabledWhenGenerator.cs | Added detection for IFunctionsWorkerApplicationBuilder.UseDisabledWhen() calls |
| tests/AzureFunctions.DisabledWhen.Tests/FunctionMetadataAppBuilderTestHost.cs | New test host helper for testing with IFunctionsWorkerApplicationBuilder |
| tests/AzureFunctions.DisabledWhen.Tests/AppBuilderStartupTests.cs | New test suite for the modern builder pattern |
| tests/AzureFunctions.DisabledWhen.SourceGenerator.Tests/FunctionMetadataAppBuilderTestHost.cs | New test host helper for testing source-generated version with IFunctionsWorkerApplicationBuilder |
| tests/AzureFunctions.DisabledWhen.SourceGenerator.Tests/AppBuilderStartupTests.cs | New test suite for source-generated version with modern builder pattern |
| sample/SampleFunctionApp/SampleFunctionApp.csproj | Changed from ProjectReference to PackageReference |
| sample/SampleFunctionApp.SourceGenerated/SampleFunctionApp.SourceGenerated.csproj | Changed from ProjectReference to PackageReference |
| README.md | Updated documentation to show both modern and legacy builder patterns |
| .github/rulesets/publish-branch.json | Added branch protection for publish workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| => builder.ConfigureServices(services => services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>()); | ||
|
|
||
| private static void UseDisabledWhenGenerated(this IFunctionsWorkerApplicationBuilder builder) | ||
| => builder.Services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>(); |
There was a problem hiding this comment.
The generated app-builder registration (UseDisabledWhenGenerated(this IFunctionsWorkerApplicationBuilder)) has the same ordering pitfall as the public extension: if it runs before the default IFunctionMetadataProvider is registered, DisabledWhen won’t be the provider resolved by the host. Consider emitting the same validation/guard behavior here as in the public extension method, so source-generated and reflection-based setups fail fast in the same way when mis-ordered.
| => builder.Services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>(); | |
| { | |
| var services = builder.Services; | |
| // Ensure the default IFunctionMetadataProvider has already been registered so that | |
| // the generated provider is not later overridden by the host's registration. | |
| if (!services.Any(d => d.ServiceType == typeof(IFunctionMetadataProvider))) | |
| { | |
| throw new InvalidOperationException( | |
| "DisabledWhen must be registered after the default IFunctionMetadataProvider. " + | |
| "Ensure that the DisabledWhen registration runs after the Functions worker has " + | |
| "configured its services (for example, after calling AddFunctionsWorkerDefaults)."); | |
| } | |
| services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>(); | |
| } |
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on #2 (comment)
|
@Anders-Toegersen I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Anders-Toegersen I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you. |
No description provided.