Skip to content

publish: prerelease 1.0.1 - #2

Closed
Anders-Toegersen wants to merge 5 commits into
publishfrom
main
Closed

Anders-Toegersen wants to merge 5 commits into
publishfrom
main

Conversation

@Anders-Toegersen

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and IFunctionsWorkerApplicationBuilder.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.

Comment thread sample/SampleFunctionApp/SampleFunctionApp.csproj

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
=> builder.ConfigureServices(services => services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>());

private static void UseDisabledWhenGenerated(this IFunctionsWorkerApplicationBuilder builder)
=> builder.Services.AddSingleton<IFunctionMetadataProvider, GeneratedDisabledWhenMetadataProvider>();

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
=> 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>();
}

Copilot uses AI. Check for mistakes.

@Anders-Toegersen Anders-Toegersen Feb 18, 2026 •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on #2 (comment)

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown

@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.

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants