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

app.UseErrorPage fails with incomplete HTML on OS X #1108

Closed
marcuslindblom opened this issue Sep 8, 2014 · 2 comments
Closed

app.UseErrorPage fails with incomplete HTML on OS X #1108

marcuslindblom opened this issue Sep 8, 2014 · 2 comments

Comments

@marcuslindblom
Copy link

Title

app.UseErrorPage fails with incomplete HTML on OS X

Functional impact

When an error occur, e.g. internal server error the error page just shows a blank page with incomplete HTML markup like this:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title>Internal Server Error</title>
        <style>
            body {
    font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
    font-size: .813em;
    line-height: 1.4em;
    color: #222;
}

h1, h2, h3, h4, h5 {
    /*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
    font-weight: 100;
}

h1 {
    color: #44525e;
    margin: 15px 0 15px 0;
}

h2 {
    margin: 10px 5px 0 0;
}

h3 {
    color: #363636;
    margin: 5px 5px 0 0;
}

code {
    font-family: Consolas, "Courier New", courier, monospace;
}

body .titleerror {
    padding: 3px;
}

body .location {
    margin: 3px 0 10px 30px;
}

#header {
    font-size: 18px;
    padding: 15px 0;
    border-top: 1px #ddd solid;
    border-bottom: 1px #ddd solid;
    margin-bottom: 0;
}

    #header li {
        display: inline;
        margin: 5px;
        padding: 5px;
        color: #a0a0a0;
        cursor: pointer;
    }

        #header li:hover {
            background: #a9e4f9;
            color: #fff;
        }

        #header .selected {
            background: #44c5f2;
            color: #fff;
        }

#stackpage ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    /*border-bottom: 1px #ddd solid;*/
}

#stackpage .stackerror {
    padding: 5px;
    border-bottom: 1px #ddd solid;
}

    #stackpage .stackerror:hover {
        background-color: #f0f0f0;
    }

#stackpage .frame:hover {
    background-color: #f0f0f0;
    text-decoration: none;
}

#stackpage .frame {
    padding: 2px;
    margin: 0 0 0 30px;
    border-bottom: 1px #ddd solid;
    cursor: pointer;
}

    #stackpage .frame h3 {
        padding: 5px;
        margin: 0;
    }

#stackpage .source {
    padding: 0;
}

    #stackpage .source ol li {
        font-family: Consolas, "Courier New", courier, monospace;
        white-space: 

Minimal repro steps

Create an empty MVC application using e.g yeoman, throw a new Exception(); in the HomeController

Expected result

A complete error page with stack trace

Actual result

A blank page with incomplete HTML

@kichalla
Copy link
Member

kichalla commented Sep 8, 2014

Thanks for reporting this issue...we have come across this earlier and are suspecting the issue is with rendering of view in this case...Can you try the following and let us know what information do you see?

Comment out the ErrorPage middleware and instead have the following in its place(here we just dumping out the raw exception messages)

app.Use(async (context, next) =>
{
    string exceptionDetails = null;

    try
    {
        await next.Invoke();
    }
    catch (Exception ex)
    {
        exceptionDetails = ex.ToString();
    }

    if (!string.IsNullOrEmpty(exceptionDetails))
    {
        context.Response.StatusCode = 500;
        context.Response.ContentType = "text/plain";
        await context.Response.WriteAsync(exceptionDetails);
    }
});

@kichalla
Copy link
Member

kichalla commented Sep 8, 2014

Moved to aspnet/Diagnostics#34

@kichalla kichalla closed this as completed Sep 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants