Azure / Azure/azure-functions-dotnet-worker
Cleanup function context creation and disposal
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
Clean up context usage in `InvocationHandler` in the `InvokeAsync` method; instead of these explicit disposal calls in the finally block, add a using statement to where the context is declared:
`using FunctionContext context = _application.CreateContext(invocationFeatures, cancellationTokenSource.Token);`
This should mean we can get rid of the context disposal calls in the finally block
Relevant comments:
https://github.com/Azure/azure-functions-dotnet-worker/pull/972#discussion_r958910198
https://github.com/Azure/azure-functions-dotnet-worker/pull/972#discussion_r958913155
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in InvocationHandler.InvokeAsync and inspect where FunctionContext is declared and where it is disposed in the finally block. Replace the explicit disposal pattern with the using declaration shown in the issue, then verify that the finally block no longer disposes the context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100