Azure / Azure/azure-functions-dotnet-worker

WorkerExtensionStartupAttribute does not work for F#

Open
#1,246 3 comments 0 reactions 0 assignees View on GitHub
external team-issue
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

# Issue

Types marked with `WorkerExtensionStartupAttribute` are not being called automatically on worker startup when using F#. This is due to this attribute relying on [ExtensionStartupRunnerGenerator](https://github.com/Azure/azure-functions-dotnet-worker/blob/main/sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs) (source gen) to function - which does not work for F#.

# Impact

Any extension which relies on that attribute to configure themselves does not work for F#. One such extension is Durable Functions, which uses that attribute to inject services and configure options.

# Workaround

In environments where source generation does not run, applications will need to manually configure extensions on startup:

``` CSharp
Host.CreateDefaultBuilder()
.ConfigureFunctionsWorkerDefaults(app =>
{
new ServiceBusExtensionStartup().Configure(app);
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs and inspect WorkerExtensionStartupAttribute handling. Compare the generated startup path with the documented ConfigureFunctionsWorkerDefaults workaround, then reproduce the issue in an F# worker. Done means attributed extensions are invoked automatically during F# worker startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, fsharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.