Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Dispose disposable HttpContext #359

Closed
benaadams opened this issue Sep 16, 2015 · 4 comments
Closed

Dispose disposable HttpContext #359

benaadams opened this issue Sep 16, 2015 · 4 comments
Assignees
Milestone

Comments

@benaadams
Copy link
Contributor

HttpContext is IDisposable so should be disposed at the end of the request.

Would suggest Func<IFeatureCollection, Task> application change to Func<IFeatureCollection, Task<IDisposable>> application in IServerFactory.Start

The Server Factory should then return the HttpContext from the closure: https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs#L88 to allow it to be disposed at the end of the request.

@muratg
Copy link

muratg commented Sep 16, 2015

@Tratcher was there a particular reason why we weren't doing this?

@Tratcher
Copy link
Member

I don't think we ever really thought though it. I don't know why it was ever marked as IDisposable in the first place, we haven't found a use for it before now. @benaadams's attempted use of it highlights some of the potential issues, such as non-deterministic lifetime.

I'd recommend removing IDisposable rather than trying to call it.

@halter73
Copy link
Member

👍 for removing IDisposable from HttpContext if possible.

@muratg muratg modified the milestones: 1.0.0-beta8, 1.0.0-rc1 Sep 18, 2015
@muratg muratg added the bug label Sep 18, 2015
@muratg
Copy link

muratg commented Sep 18, 2015

Sounds good, good riddance IDisposable!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants