Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<!-- Centralized versioning -->
<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionPrefix>1.0.1</VersionPrefix>
<VersionSuffix>prerelease</VersionSuffix>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ public static class IFunctionsWorkerApplicationBuilderExtensions
{
public static void UseDisabledWhen(this IFunctionsWorkerApplicationBuilder builder)
{
// Validate that an underlying IFunctionMetadataProvider is already registered
// This is typically done by ConfigureFunctionsWebApplication() or ConfigureFunctionsWorkerDefaults()
var hasUnderlyingProvider = builder.Services.Any(descriptor =>
descriptor.ServiceType == typeof(IFunctionMetadataProvider));

if (!hasUnderlyingProvider)
{
throw new InvalidOperationException(
"UseDisabledWhen() must be called after ConfigureFunctionsWebApplication() or ConfigureFunctionsWorkerDefaults(). " +
"No underlying IFunctionMetadataProvider was found in the service collection.");
}

builder.Services.AddSingleton<IFunctionMetadataProvider, DisabledWhenMetadataProvider>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ await testHost.StartAsync(new Dictionary<string, string?>
await Assert.That(functionNames).Contains("AlwaysEnabled");
await Assert.That(functionNames).DoesNotContain("RequiresApiKey");
}

}