IFeatureCollection has been disposed. Object name: 'Collection'. #2396
Replies: 1 comment 1 reply
-
My issue is solved: I had reported this as an issue. But I am reposting here for others if they have the same issue. Thank you for your reply. I found the issue. When running the Upgrade tool against the Isolated Function Application, it upgraded the Main Function setup to use ASP.NET Core with ConfigureFunctionsWebApplication. However, the HTTP trigger functions in my Project are not using ActionResult returns. They are using what was originally released with Isolated Functions - what is called the "build-in model". I was doing all kinds of testing and research, and decided to re-read the initial setup documentation to see what had changed, and they had a note in there. The Functions I had should have still been running under the Built in Model that was originally released. I changed my Main function builder code back to ConfigureFunctionsWorkerDefaults and my exceptions have gone away. I am still monitoring the situation. But the .NET Upgrade Tool did not alert me of the differences, but it did change my Main function builder from ConfigureFunctionsWorkerDefaults to ConfigureFunctionsWebApplication. This caused all kinds of confusion. Documentation I Found HTTP triggers allow a function to be invoked by an HTTP request. There are two different approaches that can be used: An ASP.NET Core integration model that uses concepts familiar to ASP.NET Core developers |
Beta Was this translation helpful? Give feedback.
-
I have an Azure Functions Application with multiple HTTP trigger functions. I just recently upgraded the Function Application from NET6 to NET8. When doing this upgrade the HTTP trigger functions started throwing exceptions around the Request/Response.
During the the Response creation the following exception occurs. I have tried to create the Response in many different ways during the execution of the Function. Has anyone had any similar experiences with this when moving from NET6 to NET8?
When creating the Return response following any of the below patterns causes the exception
returnResponse = request.CreateResponse(returnStatus);
Creating the response early in the Function, and then setting the status gives the same exception.
returnResponse.StatusCode = returnStatus;
FunctionResponse functionResonse = new(xcv, invocationId, "Some Information.");
await returnResponse.WriteStringAsync(functionResonse.ToString());
PLEASE SEE EXCEPTION DETAILS BELOW
IFeatureCollection has been disposed. Object name: 'Collection'.
System.ObjectDisposedException:
at Microsoft.AspNetCore.Http.Features.FeatureReferences
1.ThrowContextDisposed (Microsoft.Extensions.Features, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.Http.Features.FeatureReferences
1.Fetch (Microsoft.Extensions.Features, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)at Microsoft.AspNetCore.Http.Features.FeatureReferences`1.Fetch (Microsoft.Extensions.Features, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Http.DefaultHttpResponse.set_StatusCode (Microsoft.AspNetCore.Http, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at SAPeL.Application.Functions.ProcessingFunctions.v1.ERPEventReceiverService+d__4.MoveNext (SAPeL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:__w\1\s\CFS-MODPRU-APINV-C21P-BLDRUN-SAPeL\src\SAPeL\SAPeL\Application\Functions\ProcessingFunctions\v1\ERPEventReceiverService.cs:257)
Exception while executing function: Functions.ERPEventReceiverService Result: Failure
Exception: System.Threading.Tasks.TaskCanceledException: A task was canceled.
at SAPeL.ApplicationServices.Domain.Runtime.Telemetry.DomainTelemetry.FlushAsync(CancellationToken cancellationToken) in
Beta Was this translation helpful? Give feedback.
All reactions