StackOverFlow Exception from WebJobsBuilderExtensions while running Azure function locally
See original GitHub issueI have written Azure function which is throwing StackOverFlow Exception in the below code from class WebJobsBuilderExtensions in the namespace ` Microsoft.Azure.WebJobs
services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, JobHostService>());
Here is my Startup.cs class
` [assembly: WebJobsStartup(typeof(Startup))]
namespace FuncApp
{
public class Startup : IWebJobsStartup
{
public void Configure(IWebJobsBuilder builder)
{
var config = new ConfigurationBuilder()
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
builder.Services
.AddSingleton<IConfiguration>(config)
.AddSingleton(serviceProvider => serviceProvider)
.AddLogging();
}
}
} `
Repro steps
Reproduction steps
- Create an azure trigger function using Visual studio 2019 or 2022
- Add Startup class and add above code
- Run
Expected behavior
Azure function shall run without any exceptions
Actual behavior
Stackoverflow exception
Known workarounds
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
StackOverFlow Exception from WebJobsBuilderExtensions ...
I have written Azure function which is throwing StackOverFlow Exception in the below code from class WebJobsBuilderExtensions in the ...
Read more >StackOverFlow Exception from WebJobsBuilderExtensions ...
Coding example for the question StackOverFlow Exception from WebJobsBuilderExtensions while running Azure function locally.
Read more >StackOverflowException on local debugging environment ...
Description. Every so often (about 30-50% of the time) when I start up my Azure Durable Functions local debugging environment, I will receive ......
Read more >Stackoverflow error comes when adding serviceProvider
I had Azure function which was written using .NET Core 3.1 and suddenly stopped working and showing StackOverflow exception in below code at ......
Read more >Running Azure Functions Locally with the CLI and VS Code
When running locally, a function project (the equivalent of a Function App in Azure) is just a directory with the files host.json and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@codemaker What happens when you comment out/remove
.AddSingleton(serviceProvider => serviceProvider)
?@codemaker We are able to reproduce the issue and getting the stack overflow exception, we will check with our next level team and update you with the solution. you can share us the function app name as below so that we check the system logs and reason for the exception. Sharing Your Function App name privately