Skip to content

Removed extensibility for DefaultHttpContext #14771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JamesNK opened this issue Sep 28, 2019 · 0 comments · Fixed by #15044
Closed

Removed extensibility for DefaultHttpContext #14771

JamesNK opened this issue Sep 28, 2019 · 0 comments · Fixed by #15044
Assignees
Labels
breaking-change Indicates a .NET Core breaking change

Comments

@JamesNK
Copy link
Member

JamesNK commented Sep 28, 2019

Removed extensibility for DefaultHttpContext

As part of performance improvements made to ASP.NET Core 3.0 (dotnet/aspnetcore#6504), we've removed the extensibility of DefaultHttpContext (it is now sealed). This extensibility was provided initially to allow pooling of the HttpContext but it introduced more complexity than necessary and precluded other optimizations. As a result, we decided to remove this extensibility.

If you're using Mock<DefaultHttpContext> in your unit tests, we recommend using Mock<HttpContext> instead.

Please discuss this on dotnet/aspnetcore#6534

Version introduced

3.0

Old behavior

DefaultHttpContext could be inherited from.

New behavior

DefaultHttpContext is sealed.

Reason for change

Extensibility introduced more complexity than necessary and precluded other optimizations. As a result, we decided to remove this extensibility.

Recommended action

If you're using Mock<DefaultHttpContext> in your unit tests, we recommend using Mock<HttpContext> instead.

Category

  • ASP.NET Core

Affected APIs

DefaultHttpContext


Issue metadata

  • Issue type: breaking-change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants