-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dotnet 9 Functions IHostApplicationBuilder #3773
Comments
Thanks for raising this. We're working on improved .NET 9.0 support now on Would you consider opening a PR? |
Sure. which approach should I use? |
Not sure tbqh. @jamescrosswell opinions? If the type cast is safe, maybe that's the simplest as no new API needed |
It looks like it'd be easy to break with the cast option if someone called this incorrectly from an app that used the older else
{
throw new ArgumentException("builder is not a IHostApplicationBuilder");
} Ideally we wouldn't find out at runtime what we could prevent with static types.
|
Hi guys, public static IHostApplicationBuilder UseSentry(
this IHostApplicationBuilder builder,
Action<SentryAzureFunctionsOptions>? optionsConfiguration)
{
var services = builder.Services;
var section = builder.Configuration.GetSection("Sentry");
#if NET8_0_OR_GREATER
services.AddSingleton<IConfigureOptions<SentryAzureFunctionsOptions>>(_ =>
new SentryAzureFunctionsOptionsSetup(section)
);
#else
services.Configure<SentryAzureFunctionsOptions>(options =>
section.Bind(options));
#endif
...
} PS @cliedeman many thanks for workaround. |
Problem Statement
Dotnet 9 has included support for using the IHostApplicationBuilder style for app creation
https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=ihostapplicationbuilder%2Cwindows#start-up-and-configuration
With the new style we dont have access to the
HostBuilderContext
Temporary workaround:
I see 2 obvious solutions:
Either add a builder extension with using
FunctionsApplicationBuilder
or do a cast
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: