FeatureCache is over-checked and over-reset
benaadams opened this issue · 2 comments
benaadams commented
A simple plantext middleware as below, will check the Frame IFeatureCollection 7 times and initialize/reset the Context, Resquest and Responses feature caches twice each.
public static Task WriteResponse(HttpResponse response)
{
var payloadLength = _helloWorldPayload.Length;
response.StatusCode = 200;
response.ContentType = "text/plain";
response.ContentLength = payloadLength;
return response.Body.WriteAsync(_helloWorldPayload, 0, payloadLength);
}The extra reset and checks are from initalization; then reinitialization after RequestServicesFeature is added to the collection by the host, increasing the IFeatureCollection's version count.
muratg commented
@davidfowl thoughts? (PR is assigned to you too.)
aspnet-hello commented
This issue was moved to dotnet/aspnetcore#2693
