Merge branch 'release' of github.com:aspnet/Diagnostics into release
This commit is contained in:
commit
28bca9e312
|
|
@ -3,4 +3,4 @@ ASP.NET DiagnosticsPages
|
|||
|
||||
Diagnostics middleware.
|
||||
|
||||
This project is part of ASP.NET vNext. You can find samples, documentation and getting started instructions for ASP.NET vNext at the [Home](https://github.com/aspnet/home) repo.
|
||||
This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo.
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ IF EXIST packages\KoreBuild goto run
|
|||
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
|
||||
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
|
||||
|
||||
IF "%SKIP_KRE_INSTALL%"=="1" goto run
|
||||
CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86
|
||||
CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86
|
||||
IF "%SKIP_DOTNET_INSTALL%"=="1" goto run
|
||||
CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
|
||||
CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86
|
||||
|
||||
:run
|
||||
CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86
|
||||
CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
|
||||
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
|
||||
|
|
|
|||
4
build.sh
4
build.sh
|
|
@ -28,11 +28,11 @@ if test ! -d packages/KoreBuild; then
|
|||
fi
|
||||
|
||||
if ! type k > /dev/null 2>&1; then
|
||||
source packages/KoreBuild/build/kvm.sh
|
||||
source packages/KoreBuild/build/dotnetsdk.sh
|
||||
fi
|
||||
|
||||
if ! type k > /dev/null 2>&1; then
|
||||
kvm upgrade
|
||||
dotnetsdk upgrade
|
||||
fi
|
||||
|
||||
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>62671</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>62670</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
@ -14,5 +14,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
public DateTimeOffset Time { get; set; }
|
||||
|
||||
public bool IsCollapsed { get; set; }
|
||||
|
||||
public bool RepresentsScope { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
else
|
||||
{
|
||||
var context = GetNewActivityContext();
|
||||
context.Id = Guid.Empty; // mark as a non-scope log
|
||||
context.RepresentsScope = false; // mark as a non-scope log
|
||||
context.Root = new ScopeNode();
|
||||
context.Root.Messages.Add(info);
|
||||
_store.AddActivity(context);
|
||||
|
|
@ -69,7 +69,8 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
return new ActivityContext()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Time = DateTimeOffset.UtcNow
|
||||
Time = DateTimeOffset.UtcNow,
|
||||
RepresentsScope = true
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
}
|
||||
else
|
||||
{
|
||||
RenderRequestDetailsPage(options, context);
|
||||
RenderDetailsPage(options, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,6 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
{
|
||||
var model = new LogPageModel()
|
||||
{
|
||||
// sort so most recent logs are first
|
||||
Activities = _store.GetActivities(),
|
||||
Options = options,
|
||||
Path = _options.Path
|
||||
|
|
@ -67,24 +66,23 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
await logPage.ExecuteAsync(context);
|
||||
}
|
||||
|
||||
private async void RenderRequestDetailsPage(ViewOptions options, HttpContext context)
|
||||
private async void RenderDetailsPage(ViewOptions options, HttpContext context)
|
||||
{
|
||||
var parts = context.Request.Path.Value.Split('/');
|
||||
var id = Guid.Empty;
|
||||
if (!Guid.TryParse(parts[parts.Length - 1], out id))
|
||||
{
|
||||
context.Response.StatusCode = 400;
|
||||
await context.Response.WriteAsync("Invalid Request Id");
|
||||
await context.Response.WriteAsync("Invalid Id");
|
||||
return;
|
||||
}
|
||||
var model = new RequestPageModel()
|
||||
var model = new DetailsPageModel()
|
||||
{
|
||||
RequestID = id,
|
||||
Activity = _store.GetActivities().Where(a => a.HttpInfo?.RequestID == id).FirstOrDefault(),
|
||||
Activity = _store.GetActivities().Where(a => a.Id == id).FirstOrDefault(),
|
||||
Options = options
|
||||
};
|
||||
var requestPage = new RequestPage(model);
|
||||
await requestPage.ExecuteAsync(context);
|
||||
var detailsPage = new DetailsPage(model);
|
||||
await detailsPage.ExecuteAsync(context);
|
||||
}
|
||||
|
||||
private async Task<Tuple<ViewOptions, bool>> ParseParams(HttpContext context)
|
||||
|
|
@ -95,7 +93,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
|
|||
NamePrefix = string.Empty
|
||||
};
|
||||
var isRedirect = false;
|
||||
var form = await context.Request.GetFormAsync();
|
||||
var form = await context.Request.ReadFormAsync();
|
||||
if (form.ContainsKey("clear"))
|
||||
{
|
||||
_store.Clear();
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
namespace Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
{
|
||||
#line 1 "RequestPage.cshtml"
|
||||
#line 1 "DetailsPage.cshtml"
|
||||
using System
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 2 "RequestPage.cshtml"
|
||||
#line 2 "DetailsPage.cshtml"
|
||||
using System.Globalization
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 3 "RequestPage.cshtml"
|
||||
#line 3 "DetailsPage.cshtml"
|
||||
using System.Linq
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 4 "RequestPage.cshtml"
|
||||
#line 4 "DetailsPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Elm
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 5 "RequestPage.cshtml"
|
||||
#line 5 "DetailsPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Views
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 6 "RequestPage.cshtml"
|
||||
#line 6 "DetailsPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 7 "RequestPage.cshtml"
|
||||
#line 7 "DetailsPage.cshtml"
|
||||
using Microsoft.Framework.Logging
|
||||
|
||||
#line default
|
||||
|
|
@ -44,17 +44,17 @@ using Microsoft.Framework.Logging
|
|||
;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class RequestPage : Microsoft.AspNet.Diagnostics.Views.BaseView
|
||||
public class DetailsPage : Microsoft.AspNet.Diagnostics.Views.BaseView
|
||||
{
|
||||
public HelperResult
|
||||
#line 19 "RequestPage.cshtml"
|
||||
#line 19 "DetailsPage.cshtml"
|
||||
LogRow(LogInfo log)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return new HelperResult((__razor_helper_writer) => {
|
||||
#line 20 "RequestPage.cshtml"
|
||||
#line 20 "DetailsPage.cshtml"
|
||||
|
||||
if (log.Severity >= Model.Options.MinLevel &&
|
||||
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
|
||||
|
|
@ -64,13 +64,13 @@ LogRow(LogInfo log)
|
|||
#line hidden
|
||||
|
||||
WriteLiteralTo(__razor_helper_writer, " <tr>\r\n <td>");
|
||||
#line 25 "RequestPage.cshtml"
|
||||
#line 25 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td>");
|
||||
#line 26 "RequestPage.cshtml"
|
||||
#line 26 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
||||
|
||||
#line default
|
||||
|
|
@ -79,7 +79,7 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 768), Tuple.Create("\"", 819),
|
||||
Tuple.Create(Tuple.Create("", 776), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 776), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 27 "RequestPage.cshtml"
|
||||
#line 27 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Severity);
|
||||
|
||||
#line default
|
||||
|
|
@ -88,7 +88,7 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 856), Tuple.Create("\"", 873),
|
||||
Tuple.Create(Tuple.Create("", 864), Tuple.Create<System.Object, System.Int32>(log.Name, 864), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 28 "RequestPage.cshtml"
|
||||
#line 28 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Name);
|
||||
|
||||
#line default
|
||||
|
|
@ -97,7 +97,7 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 906), Tuple.Create("\"", 926),
|
||||
Tuple.Create(Tuple.Create("", 914), Tuple.Create<System.Object, System.Int32>(log.Message, 914), false));
|
||||
WriteLiteralTo(__razor_helper_writer, " class=\"logState\" width=\"100px\">");
|
||||
#line 29 "RequestPage.cshtml"
|
||||
#line 29 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Message);
|
||||
|
||||
#line default
|
||||
|
|
@ -106,13 +106,13 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 993), Tuple.Create("\"", 1015),
|
||||
Tuple.Create(Tuple.Create("", 1001), Tuple.Create<System.Object, System.Int32>(log.Exception, 1001), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 30 "RequestPage.cshtml"
|
||||
#line 30 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Exception);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n </tr>\r\n");
|
||||
#line 32 "RequestPage.cshtml"
|
||||
#line 32 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
|
@ -120,21 +120,21 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
|
||||
}
|
||||
);
|
||||
#line 33 "RequestPage.cshtml"
|
||||
#line 33 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
public HelperResult
|
||||
#line 35 "RequestPage.cshtml"
|
||||
#line 35 "DetailsPage.cshtml"
|
||||
Traverse(ScopeNode node)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return new HelperResult((__razor_helper_writer) => {
|
||||
#line 36 "RequestPage.cshtml"
|
||||
#line 36 "DetailsPage.cshtml"
|
||||
|
||||
var messageIndex = 0;
|
||||
var childIndex = 0;
|
||||
|
|
@ -147,12 +147,12 @@ Traverse(ScopeNode node)
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 43 "RequestPage.cshtml"
|
||||
#line 43 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex]));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 43 "RequestPage.cshtml"
|
||||
#line 43 "DetailsPage.cshtml"
|
||||
|
||||
messageIndex++;
|
||||
}
|
||||
|
|
@ -163,12 +163,12 @@ WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex]));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 48 "RequestPage.cshtml"
|
||||
#line 48 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex]));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 48 "RequestPage.cshtml"
|
||||
#line 48 "DetailsPage.cshtml"
|
||||
|
||||
childIndex++;
|
||||
}
|
||||
|
|
@ -182,12 +182,12 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex]));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 56 "RequestPage.cshtml"
|
||||
#line 56 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(node.Messages[i]));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 56 "RequestPage.cshtml"
|
||||
#line 56 "DetailsPage.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -200,12 +200,12 @@ WriteTo(__razor_helper_writer, LogRow(node.Messages[i]));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 63 "RequestPage.cshtml"
|
||||
#line 63 "DetailsPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 63 "RequestPage.cshtml"
|
||||
#line 63 "DetailsPage.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -215,25 +215,25 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
|
|||
|
||||
}
|
||||
);
|
||||
#line 66 "RequestPage.cshtml"
|
||||
#line 66 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 10 "RequestPage.cshtml"
|
||||
#line 10 "DetailsPage.cshtml"
|
||||
|
||||
public RequestPage(RequestPageModel model)
|
||||
public DetailsPage(DetailsPageModel model)
|
||||
{
|
||||
Model = model;
|
||||
}
|
||||
|
||||
public RequestPageModel Model { get; set; }
|
||||
public DetailsPageModel Model { get; set; }
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line hidden
|
||||
public RequestPage()
|
||||
public DetailsPage()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -350,13 +350,13 @@ td, th {
|
|||
<body>
|
||||
<h1>ASP.NET Logs</h1>
|
||||
");
|
||||
#line 80 "RequestPage.cshtml"
|
||||
#line 80 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 80 "RequestPage.cshtml"
|
||||
#line 80 "DetailsPage.cshtml"
|
||||
|
||||
var context = Model.Activity?.HttpInfo;
|
||||
|
||||
|
|
@ -365,13 +365,13 @@ td, th {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral("\r\n");
|
||||
#line 83 "RequestPage.cshtml"
|
||||
#line 83 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 83 "RequestPage.cshtml"
|
||||
#line 83 "DetailsPage.cshtml"
|
||||
if (context != null)
|
||||
{
|
||||
|
||||
|
|
@ -381,35 +381,35 @@ td, th {
|
|||
WriteLiteral(" <h2 id=\"requestHeader\">Request Details</h2>\r\n <table id=\"requestDe" +
|
||||
"tails\">\r\n <colgroup><col id=\"label\" /><col /></colgroup>\r\n\r\n " +
|
||||
" <tr>\r\n <th>Path</th>\r\n <td>");
|
||||
#line 91 "RequestPage.cshtml"
|
||||
#line 91 "DetailsPage.cshtml"
|
||||
Write(context.Path);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Host</th>\r\n " +
|
||||
" <td>");
|
||||
#line 95 "RequestPage.cshtml"
|
||||
#line 95 "DetailsPage.cshtml"
|
||||
Write(context.Host);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Content Type</th>" +
|
||||
"\r\n <td>");
|
||||
#line 99 "RequestPage.cshtml"
|
||||
#line 99 "DetailsPage.cshtml"
|
||||
Write(context.ContentType);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Method</th>\r\n " +
|
||||
" <td>");
|
||||
#line 103 "RequestPage.cshtml"
|
||||
#line 103 "DetailsPage.cshtml"
|
||||
Write(context.Method);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Protocol</th>\r\n " +
|
||||
" <td>");
|
||||
#line 107 "RequestPage.cshtml"
|
||||
#line 107 "DetailsPage.cshtml"
|
||||
Write(context.Protocol);
|
||||
|
||||
#line default
|
||||
|
|
@ -428,13 +428,13 @@ td, th {
|
|||
</thead>
|
||||
<tbody>
|
||||
");
|
||||
#line 120 "RequestPage.cshtml"
|
||||
#line 120 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 120 "RequestPage.cshtml"
|
||||
#line 120 "DetailsPage.cshtml"
|
||||
foreach (var header in context.Headers)
|
||||
{
|
||||
|
||||
|
|
@ -442,19 +442,19 @@ td, th {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <tr>\r\n <td>");
|
||||
#line 123 "RequestPage.cshtml"
|
||||
#line 123 "DetailsPage.cshtml"
|
||||
Write(header.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 124 "RequestPage.cshtml"
|
||||
#line 124 "DetailsPage.cshtml"
|
||||
Write(string.Join(";", header.Value));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
#line 126 "RequestPage.cshtml"
|
||||
#line 126 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
|
@ -463,27 +463,27 @@ td, th {
|
|||
WriteLiteral(" </tbody>\r\n </table>\r\n <" +
|
||||
"/td>\r\n </tr>\r\n <tr>\r\n <th>Status Code</th>\r" +
|
||||
"\n <td>");
|
||||
#line 133 "RequestPage.cshtml"
|
||||
#line 133 "DetailsPage.cshtml"
|
||||
Write(context.StatusCode);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>User</th>\r\n " +
|
||||
" <td>");
|
||||
#line 137 "RequestPage.cshtml"
|
||||
#line 137 "DetailsPage.cshtml"
|
||||
Write(context.User.Identity.Name);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Claims</th>\r\n " +
|
||||
" <td>\r\n");
|
||||
#line 142 "RequestPage.cshtml"
|
||||
#line 142 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 142 "RequestPage.cshtml"
|
||||
#line 142 "DetailsPage.cshtml"
|
||||
if (context.User.Claims.Any())
|
||||
{
|
||||
|
||||
|
|
@ -499,13 +499,13 @@ td, th {
|
|||
</thead>
|
||||
<tbody>
|
||||
");
|
||||
#line 152 "RequestPage.cshtml"
|
||||
#line 152 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 152 "RequestPage.cshtml"
|
||||
#line 152 "DetailsPage.cshtml"
|
||||
foreach (var claim in context.User.Claims)
|
||||
{
|
||||
|
||||
|
|
@ -514,26 +514,26 @@ td, th {
|
|||
|
||||
WriteLiteral(" <tr>\r\n " +
|
||||
" <td>");
|
||||
#line 155 "RequestPage.cshtml"
|
||||
#line 155 "DetailsPage.cshtml"
|
||||
Write(claim.Issuer);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 156 "RequestPage.cshtml"
|
||||
#line 156 "DetailsPage.cshtml"
|
||||
Write(claim.Value);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
#line 158 "RequestPage.cshtml"
|
||||
#line 158 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </tbody>\r\n </table>\r\n");
|
||||
#line 161 "RequestPage.cshtml"
|
||||
#line 161 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
|
@ -541,27 +541,27 @@ td, th {
|
|||
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>S" +
|
||||
"cheme</th>\r\n <td>");
|
||||
#line 166 "RequestPage.cshtml"
|
||||
#line 166 "DetailsPage.cshtml"
|
||||
Write(context.Scheme);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Query</th>\r\n " +
|
||||
" <td>");
|
||||
#line 170 "RequestPage.cshtml"
|
||||
#line 170 "DetailsPage.cshtml"
|
||||
Write(context.Query.Value);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Cookies</th>\r\n " +
|
||||
" <td>\r\n");
|
||||
#line 175 "RequestPage.cshtml"
|
||||
#line 175 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 175 "RequestPage.cshtml"
|
||||
#line 175 "DetailsPage.cshtml"
|
||||
if (context.Cookies.Any())
|
||||
{
|
||||
|
||||
|
|
@ -577,13 +577,13 @@ td, th {
|
|||
</thead>
|
||||
<tbody>
|
||||
");
|
||||
#line 185 "RequestPage.cshtml"
|
||||
#line 185 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 185 "RequestPage.cshtml"
|
||||
#line 185 "DetailsPage.cshtml"
|
||||
foreach (var cookie in context.Cookies)
|
||||
{
|
||||
|
||||
|
|
@ -592,46 +592,46 @@ td, th {
|
|||
|
||||
WriteLiteral(" <tr>\r\n " +
|
||||
" <td>");
|
||||
#line 188 "RequestPage.cshtml"
|
||||
#line 188 "DetailsPage.cshtml"
|
||||
Write(cookie.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 189 "RequestPage.cshtml"
|
||||
#line 189 "DetailsPage.cshtml"
|
||||
Write(string.Join(";", cookie.Value));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
#line 191 "RequestPage.cshtml"
|
||||
#line 191 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </tbody>\r\n </table>\r\n");
|
||||
#line 194 "RequestPage.cshtml"
|
||||
#line 194 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n");
|
||||
#line 198 "RequestPage.cshtml"
|
||||
#line 198 "DetailsPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <h2>Logs</h2>\r\n <form method=\"get\">\r\n <select name=\"level\">\r\n");
|
||||
#line 202 "RequestPage.cshtml"
|
||||
#line 202 "DetailsPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 202 "RequestPage.cshtml"
|
||||
#line 202 "DetailsPage.cshtml"
|
||||
foreach (var severity in Enum.GetValues(typeof(LogLevel)))
|
||||
{
|
||||
var severityInt = (int)severity;
|
||||
|
|
@ -645,13 +645,13 @@ td, th {
|
|||
WriteAttribute("value", Tuple.Create(" value=\"", 6703), Tuple.Create("\"", 6723),
|
||||
Tuple.Create(Tuple.Create("", 6711), Tuple.Create<System.Object, System.Int32>(severityInt, 6711), false));
|
||||
WriteLiteral(" selected=\"selected\">");
|
||||
#line 207 "RequestPage.cshtml"
|
||||
#line 207 "DetailsPage.cshtml"
|
||||
Write(severity);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option>\r\n");
|
||||
#line 208 "RequestPage.cshtml"
|
||||
#line 208 "DetailsPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -663,13 +663,13 @@ td, th {
|
|||
WriteAttribute("value", Tuple.Create(" value=\"", 6852), Tuple.Create("\"", 6872),
|
||||
Tuple.Create(Tuple.Create("", 6860), Tuple.Create<System.Object, System.Int32>(severityInt, 6860), false));
|
||||
WriteLiteral(">");
|
||||
#line 211 "RequestPage.cshtml"
|
||||
#line 211 "DetailsPage.cshtml"
|
||||
Write(severity);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option>\r\n");
|
||||
#line 212 "RequestPage.cshtml"
|
||||
#line 212 "DetailsPage.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -694,7 +694,7 @@ td, th {
|
|||
</tr>
|
||||
</thead>
|
||||
");
|
||||
#line 229 "RequestPage.cshtml"
|
||||
#line 229 "DetailsPage.cshtml"
|
||||
Write(Traverse(Model.Activity.Root));
|
||||
|
||||
#line default
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
@functions
|
||||
{
|
||||
public RequestPage(RequestPageModel model)
|
||||
public DetailsPage(DetailsPageModel model)
|
||||
{
|
||||
Model = model;
|
||||
}
|
||||
|
||||
public RequestPageModel Model { get; set; }
|
||||
public DetailsPageModel Model { get; set; }
|
||||
}
|
||||
|
||||
@helper LogRow(LogInfo log)
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js"></script>
|
||||
<style>
|
||||
<%$ include: Shared.css %>
|
||||
<%$ include: RequestPage.css %>
|
||||
<%$ include: DetailsPage.css %>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
{
|
||||
public class RequestPageModel
|
||||
public class DetailsPageModel
|
||||
{
|
||||
public Guid RequestID { get; set; }
|
||||
|
||||
public ActivityContext Activity { get; set; }
|
||||
|
||||
public ViewOptions Options { get; set; }
|
||||
|
|
@ -7,36 +7,42 @@ using System
|
|||
#line hidden
|
||||
;
|
||||
#line 2 "LogPage.cshtml"
|
||||
using System.Globalization
|
||||
using System.Collections.Generic
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 3 "LogPage.cshtml"
|
||||
using System.Linq
|
||||
using System.Globalization
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 4 "LogPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
using System.Linq
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 5 "LogPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Elm
|
||||
using Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 6 "LogPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Views
|
||||
using Microsoft.AspNet.Diagnostics.Elm
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 7 "LogPage.cshtml"
|
||||
using Microsoft.AspNet.Diagnostics.Views
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
;
|
||||
#line 8 "LogPage.cshtml"
|
||||
using Microsoft.Framework.Logging
|
||||
|
||||
#line default
|
||||
|
|
@ -47,13 +53,13 @@ using Microsoft.Framework.Logging
|
|||
public class LogPage : Microsoft.AspNet.Diagnostics.Views.BaseView
|
||||
{
|
||||
public HelperResult
|
||||
#line 20 "LogPage.cshtml"
|
||||
#line 21 "LogPage.cshtml"
|
||||
LogRow(LogInfo log, int level) {
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return new HelperResult((__razor_helper_writer) => {
|
||||
#line 20 "LogPage.cshtml"
|
||||
#line 21 "LogPage.cshtml"
|
||||
|
||||
if (log.Severity >= Model.Options.MinLevel &&
|
||||
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
|
||||
|
|
@ -63,46 +69,46 @@ LogRow(LogInfo log, int level) {
|
|||
#line hidden
|
||||
|
||||
WriteLiteralTo(__razor_helper_writer, " <tr class=\"logRow\">\r\n <td>");
|
||||
#line 25 "LogPage.cshtml"
|
||||
#line 26 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td>");
|
||||
#line 26 "LogPage.cshtml"
|
||||
#line 27 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 836), Tuple.Create("\"", 853),
|
||||
Tuple.Create(Tuple.Create("", 844), Tuple.Create<System.Object, System.Int32>(log.Name, 844), false));
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 871), Tuple.Create("\"", 888),
|
||||
Tuple.Create(Tuple.Create("", 879), Tuple.Create<System.Object, System.Int32>(log.Name, 879), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 27 "LogPage.cshtml"
|
||||
#line 28 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Name);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
|
||||
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 886), Tuple.Create("\"", 937),
|
||||
Tuple.Create(Tuple.Create("", 894), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 894), false));
|
||||
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 921), Tuple.Create("\"", 972),
|
||||
Tuple.Create(Tuple.Create("", 929), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 929), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 28 "LogPage.cshtml"
|
||||
#line 29 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Severity);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 974), Tuple.Create("\"", 994),
|
||||
Tuple.Create(Tuple.Create("", 982), Tuple.Create<System.Object, System.Int32>(log.Message, 982), false));
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1009), Tuple.Create("\"", 1029),
|
||||
Tuple.Create(Tuple.Create("", 1017), Tuple.Create<System.Object, System.Int32>(log.Message, 1017), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">\r\n");
|
||||
#line 30 "LogPage.cshtml"
|
||||
#line 31 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 30 "LogPage.cshtml"
|
||||
#line 31 "LogPage.cshtml"
|
||||
for (var i = 0; i < level; i++)
|
||||
{
|
||||
|
||||
|
|
@ -110,29 +116,29 @@ WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
|
|||
#line hidden
|
||||
|
||||
WriteLiteralTo(__razor_helper_writer, " <span class=\"tab\"></span>\r\n");
|
||||
#line 33 "LogPage.cshtml"
|
||||
#line 34 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteralTo(__razor_helper_writer, " ");
|
||||
#line 34 "LogPage.cshtml"
|
||||
#line 35 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Message);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "\r\n </td>\r\n <td");
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1197), Tuple.Create("\"", 1219),
|
||||
Tuple.Create(Tuple.Create("", 1205), Tuple.Create<System.Object, System.Int32>(log.Exception, 1205), false));
|
||||
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1232), Tuple.Create("\"", 1254),
|
||||
Tuple.Create(Tuple.Create("", 1240), Tuple.Create<System.Object, System.Int32>(log.Exception, 1240), false));
|
||||
WriteLiteralTo(__razor_helper_writer, ">");
|
||||
#line 36 "LogPage.cshtml"
|
||||
#line 37 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, log.Exception);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteralTo(__razor_helper_writer, "</td>\r\n </tr>\r\n");
|
||||
#line 38 "LogPage.cshtml"
|
||||
#line 39 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
|
@ -140,21 +146,21 @@ WriteTo(__razor_helper_writer, log.Message);
|
|||
|
||||
}
|
||||
);
|
||||
#line 39 "LogPage.cshtml"
|
||||
#line 40 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
public HelperResult
|
||||
#line 41 "LogPage.cshtml"
|
||||
Traverse(ScopeNode node, int level)
|
||||
#line 42 "LogPage.cshtml"
|
||||
Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return new HelperResult((__razor_helper_writer) => {
|
||||
#line 42 "LogPage.cshtml"
|
||||
#line 43 "LogPage.cshtml"
|
||||
|
||||
// print start of scope
|
||||
|
||||
|
|
@ -162,7 +168,7 @@ Traverse(ScopeNode node, int level)
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 44 "LogPage.cshtml"
|
||||
#line 45 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
||||
{
|
||||
Name = node.Name,
|
||||
|
|
@ -173,7 +179,7 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 50 "LogPage.cshtml"
|
||||
#line 51 "LogPage.cshtml"
|
||||
;
|
||||
var messageIndex = 0;
|
||||
var childIndex = 0;
|
||||
|
|
@ -186,13 +192,14 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 57 "LogPage.cshtml"
|
||||
#line 58 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex], level));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 57 "LogPage.cshtml"
|
||||
#line 58 "LogPage.cshtml"
|
||||
|
||||
counts[node.Messages[messageIndex].Severity.ToString()]++;
|
||||
messageIndex++;
|
||||
}
|
||||
else
|
||||
|
|
@ -202,13 +209,13 @@ WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex], level));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex], level + 1));
|
||||
#line 64 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex], level + 1, counts));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 62 "LogPage.cshtml"
|
||||
|
||||
#line 64 "LogPage.cshtml"
|
||||
|
||||
childIndex++;
|
||||
}
|
||||
}
|
||||
|
|
@ -221,13 +228,14 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex], level + 1));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 70 "LogPage.cshtml"
|
||||
#line 72 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(node.Messages[i], level));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 70 "LogPage.cshtml"
|
||||
#line 72 "LogPage.cshtml"
|
||||
|
||||
counts[node.Messages[i].Severity.ToString()]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -239,13 +247,13 @@ WriteTo(__razor_helper_writer, LogRow(node.Messages[i], level));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 77 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[i], level + 1));
|
||||
#line 80 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, Traverse(node.Children[i], level + 1, counts));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 77 "LogPage.cshtml"
|
||||
|
||||
#line 80 "LogPage.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
// print end of scope
|
||||
|
|
@ -254,7 +262,7 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[i], level + 1));
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 81 "LogPage.cshtml"
|
||||
#line 84 "LogPage.cshtml"
|
||||
WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
||||
{
|
||||
Name = node.Name,
|
||||
|
|
@ -265,7 +273,7 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 87 "LogPage.cshtml"
|
||||
#line 90 "LogPage.cshtml"
|
||||
;
|
||||
|
||||
#line default
|
||||
|
|
@ -273,13 +281,13 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
|
||||
}
|
||||
);
|
||||
#line 88 "LogPage.cshtml"
|
||||
#line 91 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 10 "LogPage.cshtml"
|
||||
#line 11 "LogPage.cshtml"
|
||||
|
||||
public LogPage(LogPageModel model)
|
||||
{
|
||||
|
|
@ -307,6 +315,7 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
<head>
|
||||
<meta charset=""utf-8"" />
|
||||
<title>ASP.NET Logs</title>
|
||||
<script src=""//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js""></script>
|
||||
<style>
|
||||
body {
|
||||
font-size: .813em;
|
||||
|
|
@ -314,7 +323,7 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
|
|||
margin: 20px;
|
||||
}
|
||||
|
||||
col:nth-child(2) {
|
||||
col:nth-child(2n) {
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
|
||||
|
|
@ -355,6 +364,13 @@ tr {
|
|||
line-height: 2em;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
color: black;
|
||||
float: right;
|
||||
font-weight: normal;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
.date, .time {
|
||||
width: 70px;
|
||||
}
|
||||
|
|
@ -391,6 +407,15 @@ tr {
|
|||
width: 80px;
|
||||
}
|
||||
|
||||
.summary {
|
||||
color: black;
|
||||
line-height: 1.8em;
|
||||
}
|
||||
|
||||
.summary>th {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.tab {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
|
@ -448,13 +473,13 @@ tr:nth-child(2n) {
|
|||
<form id=""viewOptions"" method=""get"">
|
||||
<select name=""level"">
|
||||
");
|
||||
#line 104 "LogPage.cshtml"
|
||||
#line 108 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 104 "LogPage.cshtml"
|
||||
#line 108 "LogPage.cshtml"
|
||||
foreach (var severity in Enum.GetValues(typeof(LogLevel)))
|
||||
{
|
||||
var severityInt = (int)severity;
|
||||
|
|
@ -465,16 +490,16 @@ tr:nth-child(2n) {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <option");
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3202), Tuple.Create("\"", 3222),
|
||||
Tuple.Create(Tuple.Create("", 3210), Tuple.Create<System.Object, System.Int32>(severityInt, 3210), false));
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3500), Tuple.Create("\"", 3520),
|
||||
Tuple.Create(Tuple.Create("", 3508), Tuple.Create<System.Object, System.Int32>(severityInt, 3508), false));
|
||||
WriteLiteral(" selected=\"selected\">");
|
||||
#line 109 "LogPage.cshtml"
|
||||
#line 113 "LogPage.cshtml"
|
||||
Write(severity);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option>\r\n");
|
||||
#line 110 "LogPage.cshtml"
|
||||
#line 114 "LogPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -483,16 +508,16 @@ tr:nth-child(2n) {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <option");
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3351), Tuple.Create("\"", 3371),
|
||||
Tuple.Create(Tuple.Create("", 3359), Tuple.Create<System.Object, System.Int32>(severityInt, 3359), false));
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3649), Tuple.Create("\"", 3669),
|
||||
Tuple.Create(Tuple.Create("", 3657), Tuple.Create<System.Object, System.Int32>(severityInt, 3657), false));
|
||||
WriteLiteral(">");
|
||||
#line 113 "LogPage.cshtml"
|
||||
#line 117 "LogPage.cshtml"
|
||||
Write(severity);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option>\r\n");
|
||||
#line 114 "LogPage.cshtml"
|
||||
#line 118 "LogPage.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -500,8 +525,8 @@ tr:nth-child(2n) {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" </select>\r\n <input type=\"text\" name=\"name\"");
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3484), Tuple.Create("\"", 3517),
|
||||
Tuple.Create(Tuple.Create("", 3492), Tuple.Create<System.Object, System.Int32>(Model.Options.NamePrefix, 3492), false));
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 3782), Tuple.Create("\"", 3815),
|
||||
Tuple.Create(Tuple.Create("", 3790), Tuple.Create<System.Object, System.Int32>(Model.Options.NamePrefix, 3790), false));
|
||||
WriteLiteral(@" />
|
||||
<input type=""submit"" value=""filter"" />
|
||||
</form>
|
||||
|
|
@ -513,6 +538,7 @@ tr:nth-child(2n) {
|
|||
<thead id=""requestHeader"">
|
||||
<tr>
|
||||
<th class=""path"">Path</th>
|
||||
<th class=""method"">Method</th>
|
||||
<th class=""host"">Host</th>
|
||||
<th class=""statusCode"">Status Code</th>
|
||||
<th class=""logs"">Logs</th>
|
||||
|
|
@ -523,15 +549,16 @@ tr:nth-child(2n) {
|
|||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
</colgroup>
|
||||
");
|
||||
#line 139 "LogPage.cshtml"
|
||||
#line 145 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 139 "LogPage.cshtml"
|
||||
#line 145 "LogPage.cshtml"
|
||||
foreach (var activity in Model.Activities.Reverse())
|
||||
{
|
||||
|
||||
|
|
@ -539,46 +566,72 @@ tr:nth-child(2n) {
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <tbody>\r\n <tr class=\"requestRow\">\r\n");
|
||||
#line 143 "LogPage.cshtml"
|
||||
#line 149 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 143 "LogPage.cshtml"
|
||||
#line 149 "LogPage.cshtml"
|
||||
|
||||
var activityPath = Model.Path.Value + "/" + activity.Id;
|
||||
if (activity.HttpInfo != null)
|
||||
{
|
||||
var requestPath = Model.Path.Value + "/" + activity.HttpInfo.RequestID;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <td><a");
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 4534), Tuple.Create("\"", 4553),
|
||||
Tuple.Create(Tuple.Create("", 4541), Tuple.Create<System.Object, System.Int32>(requestPath, 4541), false));
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 4554), Tuple.Create("\"", 4585),
|
||||
Tuple.Create(Tuple.Create("", 4562), Tuple.Create<System.Object, System.Int32>(activity.HttpInfo.Path, 4562), false));
|
||||
WriteLiteral(" \t<td><a");
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 4879), Tuple.Create("\"", 4899),
|
||||
Tuple.Create(Tuple.Create("", 4886), Tuple.Create<System.Object, System.Int32>(activityPath, 4886), false));
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 4900), Tuple.Create("\"", 4931),
|
||||
Tuple.Create(Tuple.Create("", 4908), Tuple.Create<System.Object, System.Int32>(activity.HttpInfo.Path, 4908), false));
|
||||
WriteLiteral(">");
|
||||
#line 147 "LogPage.cshtml"
|
||||
Write(activity.HttpInfo.Path);
|
||||
#line 153 "LogPage.cshtml"
|
||||
Write(activity.HttpInfo.Path);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</a></td>\r\n <td>");
|
||||
#line 148 "LogPage.cshtml"
|
||||
#line 154 "LogPage.cshtml"
|
||||
Write(activity.HttpInfo.Method);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 155 "LogPage.cshtml"
|
||||
Write(activity.HttpInfo.Host);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 149 "LogPage.cshtml"
|
||||
#line 156 "LogPage.cshtml"
|
||||
Write(activity.HttpInfo.StatusCode);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n");
|
||||
#line 150 "LogPage.cshtml"
|
||||
#line 157 "LogPage.cshtml"
|
||||
}
|
||||
else if (activity.RepresentsScope)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <td colspan=\"4\"><a");
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 5321), Tuple.Create("\"", 5341),
|
||||
Tuple.Create(Tuple.Create("", 5328), Tuple.Create<System.Object, System.Int32>(activityPath, 5328), false));
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 5342), Tuple.Create("\"", 5370),
|
||||
Tuple.Create(Tuple.Create("", 5350), Tuple.Create<System.Object, System.Int32>(activity.Root.State, 5350), false));
|
||||
WriteLiteral(">");
|
||||
#line 160 "LogPage.cshtml"
|
||||
Write(activity.Root.State);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</a></td>\r\n");
|
||||
#line 161 "LogPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -586,14 +639,11 @@ tr:nth-child(2n) {
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <td colspan=\"3\">");
|
||||
#line 153 "LogPage.cshtml"
|
||||
Write(activity.Root.State);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n");
|
||||
#line 154 "LogPage.cshtml"
|
||||
WriteLiteral(" <td colspan=\"4\"><a");
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 5533), Tuple.Create("\"", 5553),
|
||||
Tuple.Create(Tuple.Create("", 5540), Tuple.Create<System.Object, System.Int32>(activityPath, 5540), false));
|
||||
WriteLiteral(">Non-scope Log</a></td>\r\n");
|
||||
#line 165 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -604,39 +654,60 @@ tr:nth-child(2n) {
|
|||
<td class=""logTd"">
|
||||
<table class=""logTable"">
|
||||
<thead class=""logHeader"">
|
||||
<tr>
|
||||
<tr class=""headerRow"">
|
||||
<th class=""date"">Date</th>
|
||||
<th class=""time"">Time</th>
|
||||
<th class=""name"">Name</th>
|
||||
<th class=""severity"">Severity</th>
|
||||
<th class=""state"">State</th>
|
||||
<th>Error</th>
|
||||
<th>Error<span class=""collapse"">^</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
");
|
||||
#line 169 "LogPage.cshtml"
|
||||
#line 179 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 179 "LogPage.cshtml"
|
||||
|
||||
var counts = new Dictionary<string, int>();
|
||||
counts["Critical"] = 0;
|
||||
counts["Error"] = 0;
|
||||
counts["Warning"] = 0;
|
||||
counts["Information"] = 0;
|
||||
counts["Verbose"] = 0;
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral("\r\n <tbody class=\"logBody\">\r\n");
|
||||
#line 188 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 169 "LogPage.cshtml"
|
||||
if (activity.Id.Equals(Guid.Empty))
|
||||
#line 188 "LogPage.cshtml"
|
||||
if (!activity.RepresentsScope)
|
||||
{
|
||||
// message not within a scope
|
||||
var logInfo = activity.Root.Messages.FirstOrDefault();
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 172 "LogPage.cshtml"
|
||||
Write(LogRow(activity.Root.Messages.FirstOrDefault(), 0));
|
||||
#line 192 "LogPage.cshtml"
|
||||
Write(LogRow(logInfo, 0));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 172 "LogPage.cshtml"
|
||||
|
||||
#line 192 "LogPage.cshtml"
|
||||
|
||||
counts[logInfo.Severity.ToString()] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -645,27 +716,110 @@ tr:nth-child(2n) {
|
|||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 176 "LogPage.cshtml"
|
||||
Write(Traverse(activity.Root, 0));
|
||||
#line 197 "LogPage.cshtml"
|
||||
Write(Traverse(activity.Root, 0, counts));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#line 176 "LogPage.cshtml"
|
||||
|
||||
#line 197 "LogPage.cshtml"
|
||||
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </tbody>\r\n </table>\r\n " +
|
||||
" </td>\r\n </tr>\r\n </tbody>\r\n");
|
||||
#line 183 "LogPage.cshtml"
|
||||
WriteLiteral(" </tbody>\r\n <tbody class=\"s" +
|
||||
"ummary\">\r\n <tr class=\"logRow\">\r\n " +
|
||||
" <td>");
|
||||
#line 202 "LogPage.cshtml"
|
||||
Write(activity.Time.ToString("MM-dd-yyyy HH:mm:ss"));
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n");
|
||||
#line 203 "LogPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 203 "LogPage.cshtml"
|
||||
foreach (var kvp in counts)
|
||||
{
|
||||
if (string.Equals("Verbose", kvp.Key)) {
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <td>");
|
||||
#line 206 "LogPage.cshtml"
|
||||
Write(kvp.Value);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
#line 206 "LogPage.cshtml"
|
||||
Write(kvp.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<span class=\"collapse\">v</span></td>\r\n");
|
||||
#line 207 "LogPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <td>");
|
||||
#line 210 "LogPage.cshtml"
|
||||
Write(kvp.Value);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
#line 210 "LogPage.cshtml"
|
||||
Write(kvp.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n");
|
||||
#line 211 "LogPage.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </tr>\r\n </tbody>\r\n " +
|
||||
" </table>\r\n </td>\r\n </tr>\r\n" +
|
||||
" </tbody>\r\n");
|
||||
#line 219 "LogPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </table>\r\n</body>\r\n</html>");
|
||||
WriteLiteral(@" </table>
|
||||
<script type=""text/javascript"">
|
||||
$(document).ready(function () {
|
||||
$("".logBody"").hide();
|
||||
$("".logTable > thead"").hide();
|
||||
$("".logTable > thead"").click(function () {
|
||||
$(this).closest("".logTable"").find(""tbody"").hide();
|
||||
$(this).closest("".logTable"").find("".summary"").show();
|
||||
$(this).hide();
|
||||
});
|
||||
$("".logTable > .summary"").click(function () {
|
||||
$(this).closest("".logTable"").find(""tbody"").show();
|
||||
$(this).closest("".logTable"").find(""thead"").show();
|
||||
$(this).hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
@using System
|
||||
@using System.Collections.Generic
|
||||
@using System.Globalization
|
||||
@using System.Linq
|
||||
@using Microsoft.AspNet.Diagnostics.Elm.Views
|
||||
|
|
@ -38,7 +39,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@helper Traverse(ScopeNode node, int level)
|
||||
@helper Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
|
||||
{
|
||||
// print start of scope
|
||||
@LogRow(new LogInfo()
|
||||
|
|
@ -55,11 +56,12 @@
|
|||
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
|
||||
{
|
||||
@LogRow(node.Messages[messageIndex], level)
|
||||
counts[node.Messages[messageIndex].Severity.ToString()]++;
|
||||
messageIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@Traverse(node.Children[childIndex], level + 1)
|
||||
@Traverse(node.Children[childIndex], level + 1, counts)
|
||||
childIndex++;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,13 +70,14 @@
|
|||
for (var i = messageIndex; i < node.Messages.Count; i++)
|
||||
{
|
||||
@LogRow(node.Messages[i], level)
|
||||
counts[node.Messages[i].Severity.ToString()]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = childIndex; i < node.Children.Count; i++)
|
||||
{
|
||||
@Traverse(node.Children[i], level + 1)
|
||||
@Traverse(node.Children[i], level + 1, counts)
|
||||
}
|
||||
}
|
||||
// print end of scope
|
||||
|
|
@ -92,6 +95,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>ASP.NET Logs</title>
|
||||
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js"></script>
|
||||
<style>
|
||||
<%$ include: LogPage.css %>
|
||||
<%$ include: Shared.css %>
|
||||
|
|
@ -125,6 +129,7 @@
|
|||
<thead id="requestHeader">
|
||||
<tr>
|
||||
<th class="path">Path</th>
|
||||
<th class="method">Method</th>
|
||||
<th class="host">Host</th>
|
||||
<th class="statusCode">Status Code</th>
|
||||
<th class="logs">Logs</th>
|
||||
|
|
@ -135,52 +140,99 @@
|
|||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
</colgroup>
|
||||
@foreach (var activity in Model.Activities.Reverse())
|
||||
{
|
||||
<tbody>
|
||||
<tr class="requestRow">
|
||||
@{
|
||||
var activityPath = Model.Path.Value + "/" + activity.Id;
|
||||
if (activity.HttpInfo != null)
|
||||
{
|
||||
var requestPath = Model.Path.Value + "/" + activity.HttpInfo.RequestID;
|
||||
<td><a href="@requestPath" title="@activity.HttpInfo.Path">@activity.HttpInfo.Path</a></td>
|
||||
<td><a href="@activityPath" title="@activity.HttpInfo.Path">@activity.HttpInfo.Path</a></td>
|
||||
<td>@activity.HttpInfo.Method</td>
|
||||
<td>@activity.HttpInfo.Host</td>
|
||||
<td>@activity.HttpInfo.StatusCode</td>
|
||||
}
|
||||
else if (activity.RepresentsScope)
|
||||
{
|
||||
<td colspan="4"><a href="@activityPath" title="@activity.Root.State">@activity.Root.State</a></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td colspan="3">@activity.Root.State</td>
|
||||
<td colspan="4"><a href="@activityPath">Non-scope Log</a></td>
|
||||
}
|
||||
}
|
||||
<td class="logTd">
|
||||
<table class="logTable">
|
||||
<thead class="logHeader">
|
||||
<tr>
|
||||
<tr class="headerRow">
|
||||
<th class="date">Date</th>
|
||||
<th class="time">Time</th>
|
||||
<th class="name">Name</th>
|
||||
<th class="severity">Severity</th>
|
||||
<th class="state">State</th>
|
||||
<th>Error</th>
|
||||
<th>Error<span class="collapse">^</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (activity.Id.Equals(Guid.Empty))
|
||||
@{
|
||||
var counts = new Dictionary<string, int>();
|
||||
counts["Critical"] = 0;
|
||||
counts["Error"] = 0;
|
||||
counts["Warning"] = 0;
|
||||
counts["Information"] = 0;
|
||||
counts["Verbose"] = 0;
|
||||
}
|
||||
<tbody class="logBody">
|
||||
@if (!activity.RepresentsScope)
|
||||
{
|
||||
// message not within a scope
|
||||
@LogRow(activity.Root.Messages.FirstOrDefault(), 0)
|
||||
var logInfo = activity.Root.Messages.FirstOrDefault();
|
||||
@LogRow(logInfo, 0)
|
||||
counts[logInfo.Severity.ToString()] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@Traverse(activity.Root, 0)
|
||||
@Traverse(activity.Root, 0, counts)
|
||||
}
|
||||
</tbody>
|
||||
<tbody class="summary">
|
||||
<tr class="logRow">
|
||||
<td>@activity.Time.ToString("MM-dd-yyyy HH:mm:ss")</td>
|
||||
@foreach (var kvp in counts)
|
||||
{
|
||||
if (string.Equals("Verbose", kvp.Key)) {
|
||||
<td>@kvp.Value @kvp.Key<span class="collapse">v</span></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@kvp.Value @kvp.Key</td>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
}
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(".logBody").hide();
|
||||
$(".logTable > thead").hide();
|
||||
$(".logTable > thead").click(function () {
|
||||
$(this).closest(".logTable").find("tbody").hide();
|
||||
$(this).closest(".logTable").find(".summary").show();
|
||||
$(this).hide();
|
||||
});
|
||||
$(".logTable > .summary").click(function () {
|
||||
$(this).closest(".logTable").find("tbody").show();
|
||||
$(this).closest(".logTable").find("thead").show();
|
||||
$(this).hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
margin: 20px;
|
||||
}
|
||||
|
||||
col:nth-child(2) {
|
||||
col:nth-child(2n) {
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +45,13 @@ tr {
|
|||
line-height: 2em;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
color: black;
|
||||
float: right;
|
||||
font-weight: normal;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
.date, .time {
|
||||
width: 70px;
|
||||
}
|
||||
|
|
@ -81,6 +88,15 @@ tr {
|
|||
width: 80px;
|
||||
}
|
||||
|
||||
.summary {
|
||||
color: black;
|
||||
line-height: 1.8em;
|
||||
}
|
||||
|
||||
.summary>th {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.tab {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Threading.ExecutionContext": "4.0.0-beta-*"
|
||||
"System.Threading": "4.0.10-beta-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ using Microsoft.AspNet.Http;
|
|||
using Microsoft.AspNet.RequestContainer;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Migrations.Utilities;
|
||||
using Microsoft.Data.Entity.Relational;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Utilities;
|
||||
using Microsoft.Data.Entity.Utilities;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
|
@ -66,8 +66,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
|
|||
{
|
||||
try
|
||||
{
|
||||
if (_loggerProvider.Logger.LastError.IsErrorLogged
|
||||
&& _loggerProvider.Logger.LastError.Exception == ex)
|
||||
if (ShouldDisplayErrorPage(_loggerProvider.Logger.LastError, ex, _logger))
|
||||
{
|
||||
using (RequestServicesContainer.EnsureRequestServices(context, _serviceProvider))
|
||||
{
|
||||
|
|
@ -79,7 +78,11 @@ namespace Microsoft.AspNet.Diagnostics.Entity
|
|||
}
|
||||
else
|
||||
{
|
||||
if (dbContext.Database is RelationalDatabase)
|
||||
if (!(dbContext.Database is RelationalDatabase))
|
||||
{
|
||||
_logger.WriteVerbose(Strings.DatabaseErrorPage_NotRelationalDatabase);
|
||||
}
|
||||
else
|
||||
{
|
||||
var databaseExists = dbContext.Database.AsRelational().Exists();
|
||||
|
||||
|
|
@ -115,5 +118,31 @@ namespace Microsoft.AspNet.Diagnostics.Entity
|
|||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldDisplayErrorPage(DataStoreErrorLogger.DataStoreErrorLog lastError, Exception exception, ILogger logger)
|
||||
{
|
||||
logger.WriteVerbose(Strings.FormatDatabaseErrorPage_AttemptingToMatchException(exception.GetType()));
|
||||
|
||||
if (!lastError.IsErrorLogged)
|
||||
{
|
||||
logger.WriteVerbose(Strings.DatabaseErrorPage_NoRecordedException);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool match = false;
|
||||
for (var e = exception; e != null && !match; e = e.InnerException)
|
||||
{
|
||||
match = lastError.Exception == e;
|
||||
}
|
||||
|
||||
if (!match)
|
||||
{
|
||||
logger.WriteVerbose(Strings.DatabaseErrorPage_NoMatch);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.WriteVerbose(Strings.DatabaseErrorPage_Matched);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.AspNet.Builder;
|
|||
using Microsoft.AspNet.Diagnostics.Entity.Utilities;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using System.Net;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
|
@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
|
|||
|
||||
private static async Task<DbContext> GetDbContext(HttpContext context, ILogger logger)
|
||||
{
|
||||
var form = await context.Request.GetFormAsync().WithCurrentCulture();
|
||||
var form = await context.Request.ReadFormAsync().WithCurrentCulture();
|
||||
var contextTypeName = form["context"];
|
||||
if (string.IsNullOrWhiteSpace(contextTypeName))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -458,6 +458,86 @@ namespace Microsoft.AspNet.Diagnostics.Entity
|
|||
return GetString("DatabaseErrorPage_EnableMigrationsCommandsInfo");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// {0} occurred, checking if Entity Framework recorded this exception as resulting from a failed database operation.
|
||||
/// </summary>
|
||||
internal static string DatabaseErrorPage_AttemptingToMatchException
|
||||
{
|
||||
get { return GetString("DatabaseErrorPage_AttemptingToMatchException"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// {0} occurred, checking if Entity Framework recorded this exception as resulting from a failed database operation.
|
||||
/// </summary>
|
||||
internal static string FormatDatabaseErrorPage_AttemptingToMatchException(object p0)
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, GetString("DatabaseErrorPage_AttemptingToMatchException"), p0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity Framework recorded that the current exception was due to a failed database operation. Attempting to show database error page.
|
||||
/// </summary>
|
||||
internal static string DatabaseErrorPage_Matched
|
||||
{
|
||||
get { return GetString("DatabaseErrorPage_Matched"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity Framework recorded that the current exception was due to a failed database operation. Attempting to show database error page.
|
||||
/// </summary>
|
||||
internal static string FormatDatabaseErrorPage_Matched()
|
||||
{
|
||||
return GetString("DatabaseErrorPage_Matched");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity Framework did not record any exceptions due to failed database operations. This means the current exception is not a failed Entity Framework database operation, or the current exception occurred from a DbContext that was not obtained from request services.
|
||||
/// </summary>
|
||||
internal static string DatabaseErrorPage_NoRecordedException
|
||||
{
|
||||
get { return GetString("DatabaseErrorPage_NoRecordedException"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity Framework did not record any exceptions due to failed database operations. This means the current exception is not a failed Entity Framework database operation, or the current exception occurred from a DbContext that was not obtained from request services.
|
||||
/// </summary>
|
||||
internal static string FormatDatabaseErrorPage_NoRecordedException()
|
||||
{
|
||||
return GetString("DatabaseErrorPage_NoRecordedException");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The target data store is not a relational database. Skipping the database error page.
|
||||
/// </summary>
|
||||
internal static string DatabaseErrorPage_NotRelationalDatabase
|
||||
{
|
||||
get { return GetString("DatabaseErrorPage_NotRelationalDatabase"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The target data store is not a relational database. Skipping the database error page.
|
||||
/// </summary>
|
||||
internal static string FormatDatabaseErrorPage_NotRelationalDatabase()
|
||||
{
|
||||
return GetString("DatabaseErrorPage_NotRelationalDatabase");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current exception (and its inner exceptions) do not match the last exception Entity Framework recorded due to a failed database operation. This means the database operation exception was handled and another exception occurred later in the request.
|
||||
/// </summary>
|
||||
internal static string DatabaseErrorPage_NoMatch
|
||||
{
|
||||
get { return GetString("DatabaseErrorPage_NoMatch"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current exception (and its inner exceptions) do not match the last exception Entity Framework recorded due to a failed database operation. This means the database operation exception was handled and another exception occurred later in the request.
|
||||
/// </summary>
|
||||
internal static string FormatDatabaseErrorPage_NoMatch()
|
||||
{
|
||||
return GetString("DatabaseErrorPage_NoMatch");
|
||||
}
|
||||
|
||||
private static string GetString(string name, params string[] formatterNames)
|
||||
{
|
||||
var value = _resourceManager.GetString(name);
|
||||
|
|
|
|||
|
|
@ -201,4 +201,19 @@
|
|||
<data name="DatabaseErrorPage_EnableMigrationsCommandsInfo" xml:space="preserve">
|
||||
<value>To use migrations from a command prompt you will need to <a href='http://go.microsoft.com/fwlink/?LinkId=518242'>install K Version Manager (KVM)</a>. Once installed, you can run migration commands from a standard command prompt in the project directory.</value>
|
||||
</data>
|
||||
<data name="DatabaseErrorPage_AttemptingToMatchException" xml:space="preserve">
|
||||
<value>{0} occurred, checking if Entity Framework recorded this exception as resulting from a failed database operation.</value>
|
||||
</data>
|
||||
<data name="DatabaseErrorPage_Matched" xml:space="preserve">
|
||||
<value>Entity Framework recorded that the current exception was due to a failed database operation. Attempting to show database error page.</value>
|
||||
</data>
|
||||
<data name="DatabaseErrorPage_NoRecordedException" xml:space="preserve">
|
||||
<value>Entity Framework did not record any exceptions due to failed database operations. This means the current exception is not a failed Entity Framework database operation, or the current exception occurred from a DbContext that was not obtained from request services.</value>
|
||||
</data>
|
||||
<data name="DatabaseErrorPage_NotRelationalDatabase" xml:space="preserve">
|
||||
<value>The target data store is not a relational database. Skipping the database error page.</value>
|
||||
</data>
|
||||
<data name="DatabaseErrorPage_NoMatch" xml:space="preserve">
|
||||
<value>The current exception (and its inner exceptions) do not match the last exception Entity Framework recorded due to a failed database operation. This means the database operation exception was handled and another exception occurred later in the request.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
|
||||
"EntityFramework.Migrations": "7.0.0-*"
|
||||
"EntityFramework.Relational": "7.0.0-*"
|
||||
},
|
||||
"code": [ "**\\*.cs", "..\\Shared\\*.cs" ],
|
||||
"frameworks": {
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Threading.ExecutionContext": "4.0.0-beta-*"
|
||||
"System.Threading": "4.0.10-beta-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Framework.Runtime;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the contract for an exception representing compilation failure.
|
||||
/// </summary>
|
||||
[AssemblyNeutral]
|
||||
public interface ICompilationException
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a sequence of <see cref="ICompilationFailure"/> with compilation failures.
|
||||
/// </summary>
|
||||
IEnumerable<ICompilationFailure> CompilationFailures { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Framework.Runtime;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the contract for a file that fails compilation.
|
||||
/// </summary>
|
||||
[AssemblyNeutral]
|
||||
public interface ICompilationFailure
|
||||
{
|
||||
/// <summary>
|
||||
/// Path of the file that produced the compilation exception.
|
||||
/// </summary>
|
||||
string SourceFilePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Contents of the file.
|
||||
/// </summary>
|
||||
string SourceFileContent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Contents being compiled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For templated files, the <see cref="SourceFileContent"/> represents the original content and
|
||||
/// <see cref="CompiledContent"/> represents the transformed content. This property can be null if
|
||||
/// the exception is encountered during transformation.
|
||||
/// </remarks>
|
||||
string CompiledContent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a sequence of <see cref="ICompilationMessage"/> produced as a result of compilation.
|
||||
/// </summary>
|
||||
IEnumerable<ICompilationMessage> Messages { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.Framework.Runtime;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the contract for diagnostic messages produced as result of compiling an instance
|
||||
/// of <see cref="ICompilationFailure"/>.
|
||||
/// </summary>
|
||||
[AssemblyNeutral]
|
||||
public interface ICompilationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error message.
|
||||
/// </summary>
|
||||
string Message { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the zero-based line index for the start of the compilation error.
|
||||
/// </summary>
|
||||
int StartLine { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the zero-based column index for the start of the compilation error.
|
||||
/// </summary>
|
||||
int StartColumn { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the zero-based line index for the end of the compilation error.
|
||||
/// </summary>
|
||||
int EndLine { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the zero-based column index for the end of the compilation error.
|
||||
/// </summary>
|
||||
int EndColumn { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -76,7 +76,70 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
}
|
||||
|
||||
// Assumes the response headers have not been sent. If they have, still attempt to write to the body.
|
||||
private async Task DisplayException(HttpContext context, Exception ex)
|
||||
private Task DisplayException(HttpContext context, Exception ex)
|
||||
{
|
||||
var compilationException = ex as ICompilationException;
|
||||
if (compilationException != null)
|
||||
{
|
||||
return DisplayCompilationException(context, ex, compilationException);
|
||||
}
|
||||
|
||||
return DisplayRuntimeException(context, ex);
|
||||
}
|
||||
|
||||
private Task DisplayCompilationException(HttpContext context,
|
||||
Exception ex,
|
||||
ICompilationException compilationException)
|
||||
{
|
||||
var stackFrames = new List<StackFrame>();
|
||||
var model = new CompilationErrorPageModel()
|
||||
{
|
||||
Options = _options,
|
||||
ErrorDetails = new ErrorDetails
|
||||
{
|
||||
Error = ex,
|
||||
StackFrames = stackFrames
|
||||
}
|
||||
};
|
||||
|
||||
// For view compilation, the most common case is to stop at the first failing file compiled as part of
|
||||
// rendering a view. Consequently we'll limit ourselves to displaying errors from the first failure.
|
||||
var failedCompilationFile = compilationException.CompilationFailures.FirstOrDefault();
|
||||
if (failedCompilationFile != null)
|
||||
{
|
||||
var fileContent = failedCompilationFile.SourceFileContent
|
||||
.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
|
||||
foreach (var item in failedCompilationFile.Messages)
|
||||
{
|
||||
// Convert 0-based line indexes to 1-based index that the StackFrame expects
|
||||
var lineIndex = item.StartLine + 1;
|
||||
var frame = new StackFrame
|
||||
{
|
||||
File = failedCompilationFile.SourceFilePath,
|
||||
Line = lineIndex,
|
||||
Function = string.Empty
|
||||
};
|
||||
|
||||
if (_options.ShowSourceCode)
|
||||
{
|
||||
ReadFrameContent(frame, fileContent, lineIndex, item.EndLine + 1);
|
||||
frame.ErrorDetails = item.Message;
|
||||
}
|
||||
|
||||
stackFrames.Add(frame);
|
||||
}
|
||||
}
|
||||
|
||||
var errorPage = new CompilationErrorPage
|
||||
{
|
||||
Model = model
|
||||
};
|
||||
|
||||
return errorPage.ExecuteAsync(context);
|
||||
}
|
||||
|
||||
private Task DisplayRuntimeException(HttpContext context, Exception ex)
|
||||
{
|
||||
var request = context.Request;
|
||||
|
||||
|
|
@ -107,7 +170,7 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
}*/
|
||||
|
||||
var errorPage = new ErrorPage(model);
|
||||
await errorPage.ExecuteAsync(context);
|
||||
return errorPage.ExecuteAsync(context);
|
||||
}
|
||||
|
||||
private IEnumerable<ErrorDetails> GetErrorDetails(Exception ex, bool showSource)
|
||||
|
|
@ -160,14 +223,22 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
if (showSource && File.Exists(file))
|
||||
{
|
||||
IEnumerable<string> code = File.ReadLines(file);
|
||||
frame.PreContextLine = Math.Max(lineNumber - _options.SourceCodeLineCount, 1);
|
||||
frame.PreContextCode = code.Skip(frame.PreContextLine - 1).Take(lineNumber - frame.PreContextLine).ToArray();
|
||||
frame.ContextCode = code.Skip(lineNumber - 1).FirstOrDefault();
|
||||
frame.PostContextCode = code.Skip(lineNumber).Take(_options.SourceCodeLineCount).ToArray();
|
||||
ReadFrameContent(frame, code, lineNumber, lineNumber);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
private void ReadFrameContent(StackFrame frame,
|
||||
IEnumerable<string> code,
|
||||
int startLineNumber,
|
||||
int endLineNumber)
|
||||
{
|
||||
frame.PreContextLine = Math.Max(startLineNumber - _options.SourceCodeLineCount, 1);
|
||||
frame.PreContextCode = code.Skip(frame.PreContextLine - 1).Take(startLineNumber - frame.PreContextLine).ToArray();
|
||||
frame.ContextCode = code.Skip(startLineNumber - 1).Take(1 + Math.Max(0, endLineNumber - startLineNumber));
|
||||
frame.PostContextCode = code.Skip(startLineNumber).Take(_options.SourceCodeLineCount).ToArray();
|
||||
}
|
||||
|
||||
internal class Chunk
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// Version
|
||||
/// </summary>
|
||||
internal static string RuntimeInfoPage_PackageVersionColumnName
|
||||
{
|
||||
|
|
@ -387,7 +387,7 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// Version
|
||||
/// </summary>
|
||||
internal static string FormatRuntimeInfoPage_PackageVersionColumnName()
|
||||
{
|
||||
|
|
@ -570,6 +570,22 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
return GetString("WelcomeTitle");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
|
||||
/// </summary>
|
||||
internal static string ErrorPageHtml_CompilationException
|
||||
{
|
||||
get { return GetString("ErrorPageHtml_CompilationException"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
|
||||
/// </summary>
|
||||
internal static string FormatErrorPageHtml_CompilationException()
|
||||
{
|
||||
return GetString("ErrorPageHtml_CompilationException");
|
||||
}
|
||||
|
||||
private static string GetString(string name, params string[] formatterNames)
|
||||
{
|
||||
var value = _resourceManager.GetString(name);
|
||||
|
|
|
|||
|
|
@ -230,4 +230,7 @@
|
|||
<data name="WelcomeTitle" xml:space="preserve">
|
||||
<value>Your ASP.NET vNext application has been successfully started.</value>
|
||||
</data>
|
||||
<data name="ErrorPageHtml_CompilationException" xml:space="preserve">
|
||||
<value>An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Diagnostics
|
|||
|
||||
private static string GetRuntimeVersion()
|
||||
{
|
||||
var klr = Assembly.Load(new AssemblyName("klr.host"));
|
||||
var klr = Assembly.Load(new AssemblyName("dotnet.host"));
|
||||
var version = klr.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||
return version?.InformationalVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds data to be displayed on the compilation error page.
|
||||
/// </summary>
|
||||
public class CompilationErrorPageModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for what output to display.
|
||||
/// </summary>
|
||||
public ErrorPageOptions Options { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Detailed information about each parse or compilation error.
|
||||
/// </summary>
|
||||
public ErrorDetails ErrorDetails { get; set; }
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,101 @@
|
|||
@using System
|
||||
@using System.Globalization
|
||||
@using System.Linq
|
||||
@using System.Net
|
||||
@using Views
|
||||
@functions
|
||||
{
|
||||
public CompilationErrorPageModel Model { get; set; }
|
||||
}
|
||||
@{
|
||||
var errorDetail = Model.ErrorDetails;
|
||||
|
||||
Response.StatusCode = 500;
|
||||
Response.ContentType = "text/html";
|
||||
Response.ContentLength = null; // Clear any prior Content-Length
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>@Resources.ErrorPageHtml_Title</title>
|
||||
<style>
|
||||
<%$ include: ErrorPage.css %>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>@Resources.ErrorPageHtml_CompilationException</h1>
|
||||
@if (Model.Options.ShowExceptionDetails)
|
||||
{
|
||||
<div class="titleerror">@errorDetail.Error.GetType().Name: @{ Output.Write(WebUtility.HtmlEncode(errorDetail.Error.Message).Replace("\r\n", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>")); }</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2>@Resources.ErrorPageHtml_EnableShowExceptions</h2>
|
||||
}
|
||||
@if (Model.Options.ShowExceptionDetails)
|
||||
{
|
||||
<div id="stackpage" class="page">
|
||||
@{ int tabIndex = 6; }
|
||||
<br />
|
||||
<ul>
|
||||
@foreach (var frame in errorDetail.StackFrames)
|
||||
{
|
||||
<li class="frame" tabindex="@tabIndex">
|
||||
@{ tabIndex++; }
|
||||
@if (!string.IsNullOrEmpty(frame.ErrorDetails))
|
||||
{
|
||||
<h3>@frame.ErrorDetails</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(frame.File))
|
||||
{
|
||||
<h3>@frame.Function</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>@frame.Function in <code title="@frame.File">@System.IO.Path.GetFileName(frame.File)</code></h3>
|
||||
}
|
||||
}
|
||||
@if (frame.Line != 0 && frame.ContextCode.Any())
|
||||
{
|
||||
<div class="source">
|
||||
@if (frame.PreContextCode != null)
|
||||
{
|
||||
<ol start="@frame.PreContextLine" class="collapsible">
|
||||
@foreach (var line in frame.PreContextCode)
|
||||
{
|
||||
<li><span>@line</span></li>
|
||||
}
|
||||
</ol>
|
||||
}
|
||||
<ol start="@frame.Line" class="highlight">
|
||||
@foreach (var line in frame.ContextCode)
|
||||
{
|
||||
<li><span>@line</span></li>
|
||||
}
|
||||
</ol>
|
||||
@if (frame.PostContextCode != null)
|
||||
{
|
||||
<ol start='@(frame.Line + 1)' class="collapsible">
|
||||
@foreach (var line in frame.PostContextCode)
|
||||
{
|
||||
<li><span>@line</span></li>
|
||||
}
|
||||
</ol>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
<script>
|
||||
//<!--
|
||||
<%$ include: ErrorPage.js %>
|
||||
//-->
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -472,7 +472,7 @@ using Views
|
|||
#line hidden
|
||||
|
||||
#line 123 "ErrorPage.cshtml"
|
||||
if (frame.Line != 0 && frame.ContextCode != null)
|
||||
if (frame.Line != 0 && frame.ContextCode.Any())
|
||||
{
|
||||
|
||||
#line default
|
||||
|
|
@ -493,8 +493,8 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <ol");
|
||||
WriteAttribute("start", Tuple.Create(" start=\"", 5277), Tuple.Create("\"", 5306),
|
||||
Tuple.Create(Tuple.Create("", 5285), Tuple.Create<System.Object, System.Int32>(frame.PreContextLine, 5285), false));
|
||||
WriteAttribute("start", Tuple.Create(" start=\"", 5275), Tuple.Create("\"", 5304),
|
||||
Tuple.Create(Tuple.Create("", 5283), Tuple.Create<System.Object, System.Int32>(frame.PreContextLine, 5283), false));
|
||||
WriteLiteral(" class=\"collapsible\">\r\n");
|
||||
#line 129 "ErrorPage.cshtml"
|
||||
|
||||
|
|
@ -530,22 +530,43 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral("\r\n <ol");
|
||||
WriteAttribute("start", Tuple.Create(" start=\"", 5774), Tuple.Create("\"", 5793),
|
||||
Tuple.Create(Tuple.Create("", 5782), Tuple.Create<System.Object, System.Int32>(frame.Line, 5782), false));
|
||||
WriteLiteral(" class=\"highlight\">\r\n <li><span>");
|
||||
WriteAttribute("start", Tuple.Create(" start=\"", 5772), Tuple.Create("\"", 5791),
|
||||
Tuple.Create(Tuple.Create("", 5780), Tuple.Create<System.Object, System.Int32>(frame.Line, 5780), false));
|
||||
WriteLiteral(" class=\"highlight\">\r\n");
|
||||
#line 137 "ErrorPage.cshtml"
|
||||
Write(frame.ContextCode);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span></li></ol>\r\n\r\n");
|
||||
|
||||
#line 137 "ErrorPage.cshtml"
|
||||
foreach (var line in frame.ContextCode)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" <li><span>");
|
||||
#line 139 "ErrorPage.cshtml"
|
||||
Write(line);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span></li>\r\n");
|
||||
#line 140 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </ol>\r\n\r\n");
|
||||
#line 143 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 139 "ErrorPage.cshtml"
|
||||
#line 143 "ErrorPage.cshtml"
|
||||
if (frame.PostContextCode != null)
|
||||
{
|
||||
|
||||
|
|
@ -553,16 +574,16 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <ol");
|
||||
WriteAttribute("start", Tuple.Create(" start=\'", 6091), Tuple.Create("\'", 6116),
|
||||
Tuple.Create(Tuple.Create("", 6099), Tuple.Create<System.Object, System.Int32>(frame.Line + 1, 6099), false));
|
||||
WriteAttribute("start", Tuple.Create(" start=\'", 6318), Tuple.Create("\'", 6343),
|
||||
Tuple.Create(Tuple.Create("", 6326), Tuple.Create<System.Object, System.Int32>(frame.Line + 1, 6326), false));
|
||||
WriteLiteral(" class=\"collapsible\">\r\n");
|
||||
#line 142 "ErrorPage.cshtml"
|
||||
#line 146 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 142 "ErrorPage.cshtml"
|
||||
#line 146 "ErrorPage.cshtml"
|
||||
foreach (var line in frame.PostContextCode)
|
||||
{
|
||||
|
||||
|
|
@ -570,55 +591,55 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <li><span>");
|
||||
#line 144 "ErrorPage.cshtml"
|
||||
#line 148 "ErrorPage.cshtml"
|
||||
Write(line);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span></li>\r\n");
|
||||
#line 145 "ErrorPage.cshtml"
|
||||
#line 149 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </ol>\r\n");
|
||||
#line 147 "ErrorPage.cshtml"
|
||||
#line 151 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </div>\r\n");
|
||||
#line 149 "ErrorPage.cshtml"
|
||||
#line 153 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </li>\r\n");
|
||||
#line 151 "ErrorPage.cshtml"
|
||||
#line 155 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </ul>\r\n </li>\r\n");
|
||||
#line 154 "ErrorPage.cshtml"
|
||||
#line 158 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </ul>\r\n </div>\r\n");
|
||||
#line 157 "ErrorPage.cshtml"
|
||||
#line 161 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" ");
|
||||
#line 158 "ErrorPage.cshtml"
|
||||
#line 162 "ErrorPage.cshtml"
|
||||
if (Model.Options.ShowQuery)
|
||||
{
|
||||
|
||||
|
|
@ -626,13 +647,13 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <div id=\"querypage\" class=\"page\">\r\n");
|
||||
#line 161 "ErrorPage.cshtml"
|
||||
#line 165 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 161 "ErrorPage.cshtml"
|
||||
#line 165 "ErrorPage.cshtml"
|
||||
if (Model.Query.Any())
|
||||
{
|
||||
|
||||
|
|
@ -641,26 +662,26 @@ using Views
|
|||
|
||||
WriteLiteral(" <table>\r\n <thead>\r\n " +
|
||||
" <tr>\r\n <th>");
|
||||
#line 166 "ErrorPage.cshtml"
|
||||
#line 170 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_VariableColumn);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</th>\r\n <th>");
|
||||
#line 167 "ErrorPage.cshtml"
|
||||
#line 171 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_ValueColumn);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " +
|
||||
" <tbody>\r\n");
|
||||
#line 171 "ErrorPage.cshtml"
|
||||
#line 175 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 171 "ErrorPage.cshtml"
|
||||
#line 175 "ErrorPage.cshtml"
|
||||
foreach (var kv in Model.Query.OrderBy(kv => kv.Key))
|
||||
{
|
||||
foreach (var v in kv.Value)
|
||||
|
|
@ -671,19 +692,19 @@ using Views
|
|||
|
||||
WriteLiteral(" <tr>\r\n " +
|
||||
" <td>");
|
||||
#line 176 "ErrorPage.cshtml"
|
||||
#line 180 "ErrorPage.cshtml"
|
||||
Write(kv.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 177 "ErrorPage.cshtml"
|
||||
#line 181 "ErrorPage.cshtml"
|
||||
Write(v);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
#line 179 "ErrorPage.cshtml"
|
||||
#line 183 "ErrorPage.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +712,7 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" </tbody>\r\n </table>\r\n");
|
||||
#line 183 "ErrorPage.cshtml"
|
||||
#line 187 "ErrorPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -700,27 +721,27 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <p>");
|
||||
#line 186 "ErrorPage.cshtml"
|
||||
#line 190 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_NoQueryStringData);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</p>\r\n");
|
||||
#line 187 "ErrorPage.cshtml"
|
||||
#line 191 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </div>\r\n");
|
||||
#line 189 "ErrorPage.cshtml"
|
||||
#line 193 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" ");
|
||||
#line 190 "ErrorPage.cshtml"
|
||||
#line 194 "ErrorPage.cshtml"
|
||||
if (Model.Options.ShowCookies)
|
||||
{
|
||||
/* TODO:
|
||||
|
|
@ -757,7 +778,7 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" ");
|
||||
#line 221 "ErrorPage.cshtml"
|
||||
#line 225 "ErrorPage.cshtml"
|
||||
if (Model.Options.ShowHeaders)
|
||||
{
|
||||
|
||||
|
|
@ -765,13 +786,13 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <div id=\"headerspage\" class=\"page\">\r\n");
|
||||
#line 224 "ErrorPage.cshtml"
|
||||
#line 228 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 224 "ErrorPage.cshtml"
|
||||
#line 228 "ErrorPage.cshtml"
|
||||
if (Model.Headers.Any())
|
||||
{
|
||||
|
||||
|
|
@ -780,26 +801,26 @@ using Views
|
|||
|
||||
WriteLiteral(" <table>\r\n <thead>\r\n " +
|
||||
" <tr>\r\n <th>");
|
||||
#line 229 "ErrorPage.cshtml"
|
||||
#line 233 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_VariableColumn);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</th>\r\n <th>");
|
||||
#line 230 "ErrorPage.cshtml"
|
||||
#line 234 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_ValueColumn);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " +
|
||||
" <tbody>\r\n");
|
||||
#line 234 "ErrorPage.cshtml"
|
||||
#line 238 "ErrorPage.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 234 "ErrorPage.cshtml"
|
||||
#line 238 "ErrorPage.cshtml"
|
||||
foreach (var kv in Model.Headers.OrderBy(kv => kv.Key))
|
||||
{
|
||||
foreach (var v in kv.Value)
|
||||
|
|
@ -810,19 +831,19 @@ using Views
|
|||
|
||||
WriteLiteral(" <tr>\r\n " +
|
||||
" <td>");
|
||||
#line 239 "ErrorPage.cshtml"
|
||||
#line 243 "ErrorPage.cshtml"
|
||||
Write(kv.Key);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
#line 240 "ErrorPage.cshtml"
|
||||
#line 244 "ErrorPage.cshtml"
|
||||
Write(v);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
#line 242 "ErrorPage.cshtml"
|
||||
#line 246 "ErrorPage.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -830,7 +851,7 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" </tbody>\r\n </table>\r\n");
|
||||
#line 246 "ErrorPage.cshtml"
|
||||
#line 250 "ErrorPage.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -839,27 +860,27 @@ using Views
|
|||
#line hidden
|
||||
|
||||
WriteLiteral(" <p>");
|
||||
#line 249 "ErrorPage.cshtml"
|
||||
#line 253 "ErrorPage.cshtml"
|
||||
Write(Resources.ErrorPageHtml_NoHeaderData);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</p>\r\n");
|
||||
#line 250 "ErrorPage.cshtml"
|
||||
#line 254 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" </div>\r\n");
|
||||
#line 252 "ErrorPage.cshtml"
|
||||
#line 256 "ErrorPage.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
WriteLiteral(" ");
|
||||
#line 253 "ErrorPage.cshtml"
|
||||
#line 257 "ErrorPage.cshtml"
|
||||
if (Model.Options.ShowEnvironment)
|
||||
{
|
||||
/* TODO:
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@
|
|||
<h3>@frame.Function in <code title="@frame.File">@System.IO.Path.GetFileName(frame.File)</code></h3>
|
||||
}
|
||||
|
||||
@if (frame.Line != 0 && frame.ContextCode != null)
|
||||
@if (frame.Line != 0 && frame.ContextCode.Any())
|
||||
{
|
||||
<div class="source">
|
||||
@if (frame.PreContextCode != null)
|
||||
|
|
@ -134,7 +134,11 @@
|
|||
}
|
||||
|
||||
<ol start="@frame.Line" class="highlight">
|
||||
<li><span>@frame.ContextCode</span></li></ol>
|
||||
@foreach (var line in frame.ContextCode)
|
||||
{
|
||||
<li><span>@line</span></li>
|
||||
}
|
||||
</ol>
|
||||
|
||||
@if (frame.PostContextCode != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,11 +39,16 @@ namespace Microsoft.AspNet.Diagnostics.Views
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ContextCode { get; set; }
|
||||
public IEnumerable<string> ContextCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IEnumerable<string> PostContextCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specific error details for this stack frame.
|
||||
/// </summary>
|
||||
public string ErrorDetails { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
"version": "1.0.0-*",
|
||||
"description": "ASP.NET 5 Middleware for error handling, error pages, and diagnostics information.",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.PipelineCore": "1.0.0-*",
|
||||
"Microsoft.AspNet.RequestContainer": "1.0.0-*",
|
||||
"Microsoft.Framework.Runtime.Interfaces": { "version": "1.0.0-*", "type": "build" }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ using Microsoft.AspNet.Http;
|
|||
using Microsoft.AspNet.TestHost;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Utilities;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
|
@ -235,7 +235,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
{
|
||||
services.AddEntityFramework().AddSqlServer();
|
||||
services.AddScoped<BloggingContextWithMigrations>();
|
||||
services.AddInstance<DbContextOptions>(new DbContextOptions().UseSqlServer(database.ConnectionString));
|
||||
|
||||
var contextOptions = new DbContextOptions();
|
||||
contextOptions.UseSqlServer(database.ConnectionString);
|
||||
services.AddInstance<DbContextOptions>(contextOptions);
|
||||
});
|
||||
|
||||
var options = DatabaseErrorPageOptions.ShowAll;
|
||||
|
|
@ -268,9 +271,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
services.AddEntityFramework()
|
||||
.AddSqlServer();
|
||||
|
||||
services.AddInstance<DbContextOptions>(
|
||||
new DbContextOptions()
|
||||
.UseSqlServer(database.ConnectionString));
|
||||
var options = new DbContextOptions();
|
||||
options.UseSqlServer(database.ConnectionString);
|
||||
|
||||
services.AddInstance<DbContextOptions>(options);
|
||||
});
|
||||
|
||||
app.UseDatabaseErrorPage();
|
||||
|
|
@ -338,6 +342,41 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Error_page_displayed_when_exception_wrapped()
|
||||
{
|
||||
TestServer server = SetupTestServer<BloggingContext, WrappedExceptionMiddleware>();
|
||||
HttpResponseMessage response = await server.CreateClient().GetAsync("http://localhost/");
|
||||
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
Assert.Contains("I wrapped your exception", content);
|
||||
Assert.Contains(StringsHelpers.GetResourceString("FormatDatabaseErrorPage_NoDbOrMigrationsTitle", typeof(BloggingContext).Name), content);
|
||||
}
|
||||
|
||||
class WrappedExceptionMiddleware
|
||||
{
|
||||
public WrappedExceptionMiddleware(RequestDelegate next)
|
||||
{ }
|
||||
|
||||
public virtual Task Invoke(HttpContext context)
|
||||
{
|
||||
using (var db = context.ApplicationServices.GetService<BloggingContext>())
|
||||
{
|
||||
db.Blogs.Add(new Blog());
|
||||
try
|
||||
{
|
||||
db.SaveChanges();
|
||||
throw new Exception("SaveChanges should have thrown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("I wrapped your exception", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TestServer SetupTestServer<TContext, TMiddleware>(ILoggerProvider logProvider = null)
|
||||
where TContext : DbContext
|
||||
{
|
||||
|
|
@ -351,9 +390,11 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
.AddSqlServer();
|
||||
|
||||
services.AddScoped<TContext>();
|
||||
services.AddInstance<DbContextOptions>(
|
||||
new DbContextOptions()
|
||||
.UseSqlServer(database.ConnectionString));
|
||||
|
||||
var options = new DbContextOptions();
|
||||
options.UseSqlServer(database.ConnectionString);
|
||||
|
||||
services.AddInstance<DbContextOptions>(options);
|
||||
});
|
||||
|
||||
app.UseDatabaseErrorPage();
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ using Microsoft.AspNet.Http;
|
|||
using Microsoft.AspNet.TestHost;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Migrations.Utilities;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Utilities;
|
||||
using Microsoft.Data.Entity.Utilities;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Xunit;
|
||||
|
|
@ -65,7 +65,8 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
{
|
||||
using (var database = SqlServerTestStore.CreateScratch())
|
||||
{
|
||||
var options = new DbContextOptions().UseSqlServer(database.ConnectionString);
|
||||
var options = new DbContextOptions();
|
||||
options.UseSqlServer(database.ConnectionString);
|
||||
var path = useCustomPath ? new PathString("/EndPoints/ApplyMyMigrations") : MigrationsEndPointOptions.DefaultPath;
|
||||
|
||||
TestServer server = TestServer.Create(app =>
|
||||
|
|
@ -183,7 +184,8 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
{
|
||||
using (var database = SqlServerTestStore.CreateScratch())
|
||||
{
|
||||
var options = new DbContextOptions().UseSqlServer(database.ConnectionString);
|
||||
var options = new DbContextOptions();
|
||||
options.UseSqlServer(database.ConnectionString);
|
||||
|
||||
TestServer server = TestServer.Create(app =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
|||
|
||||
private void EnsureDeleted()
|
||||
{
|
||||
using (var db = new DbContext(new DbContextOptions().UseSqlServer(_connectionString)))
|
||||
var options = new DbContextOptions();
|
||||
options.UseSqlServer(_connectionString);
|
||||
|
||||
using (var db = new DbContext(options))
|
||||
{
|
||||
db.Database.EnsureDeleted();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Microsoft.Data.Entity.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Migrations.Infrastructure;
|
||||
using Microsoft.Data.Entity.Relational.Migrations;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Builders;
|
||||
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*",
|
||||
"Microsoft.AspNet.Diagnostics.Entity.Tests": "1.0.0",
|
||||
"Microsoft.AspNet.TestHost": "1.0.0-*",
|
||||
"Xunit.KRunner": "1.0.0-*"
|
||||
"xunit.runner.kre": "1.0.0-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
"test": "xunit.runner.kre"
|
||||
},
|
||||
"frameworks": {
|
||||
"aspnet50": { }
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
"EntityFramework.InMemory": "7.0.0-*",
|
||||
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"Xunit.KRunner": "1.0.0-*"
|
||||
"xunit.runner.kre": "1.0.0-*"
|
||||
},
|
||||
"code": [ "**\\*.cs", "..\\Shared\\ApiConsistencyTestBase.cs", "..\\Shared\\TestHelpers.cs" ],
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
"test": "xunit.runner.kre"
|
||||
},
|
||||
"frameworks": {
|
||||
"aspnet50": { }
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Microsoft.AspNet.Diagnostics.Tests
|
|||
|
||||
// Assert
|
||||
contextMock.VerifyGet(c => c.Request.Query, Times.AtLeastOnce());
|
||||
Assert.True(response.Contains("Invalid Request Id"));
|
||||
Assert.True(response.Contains("Invalid Id"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,8 +205,8 @@ namespace Microsoft.AspNet.Diagnostics.Tests
|
|||
.SetupGet(c => c.Request.Cookies)
|
||||
.Returns(new Mock<IReadableStringCollection>().Object);
|
||||
contextMock
|
||||
.Setup(c => c.Request.GetFormAsync(It.IsAny<System.Threading.CancellationToken>()))
|
||||
.Returns(Task.FromResult(new Mock<IReadableStringCollection>().Object));
|
||||
.Setup(c => c.Request.ReadFormAsync(It.IsAny<System.Threading.CancellationToken>()))
|
||||
.Returns(Task.FromResult(new Mock<IFormCollection>().Object));
|
||||
|
||||
return contextMock;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*",
|
||||
"Xunit.KRunner": "1.0.0-*"
|
||||
"xunit.runner.kre": "1.0.0-*"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
@ -17,6 +17,6 @@
|
|||
}
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
"test": "xunit.runner.kre"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue