Skip to content

UseDeveloperExceptionPage() doesn't work if exception is thrown after starting to write response #2593

Closed
@aspnet-hello

Description

@aspnet-hello

From @mikeharder on Thursday, May 5, 2016 4:41:03 PM

The following user code shows the exception page as expected:

app.UseDeveloperExceptionPage();
app.Run(async (context) =>
{
    throw new Exception();
    await context.Response.WriteAsync("hello");
});

However, the following user code just gets an incomplete response and no exception page:

app.UseDeveloperExceptionPage();
app.Run(async (context) =>
{
    await context.Response.WriteAsync("hello");
    throw new Exception();
});

In ASP.NET 4.6, I believe we buffer responses (at least by default), so developers get a nice error page almost anywhere an exception is thrown. We may want to do the same in ASP.NET Core, perhaps only when running in debug mode or only when UseDeveloperExceptionPage() has been called.

Copied from original issue: aspnet/Diagnostics#281

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: DesignThis issue requires design work before implementating.area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-diagnosticsDiagnostic middleware and pages (except EF diagnostics)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions