diff --git a/README.md b/README.md index 5a8d48556d..7d8c5d8a51 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.cmd b/build.cmd index 86ca5bbbf1..220a1ff561 100644 --- a/build.cmd +++ b/build.cmd @@ -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 %* diff --git a/build.sh b/build.sh index c7873ef58e..350d7e389a 100644 --- a/build.sh +++ b/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 "$@" diff --git a/samples/ErrorHandlerSample/ErrorHandlerSample.kproj b/samples/ErrorHandlerSample/ErrorHandlerSample.kproj index 883977b1ee..cfdbec9b85 100644 --- a/samples/ErrorHandlerSample/ErrorHandlerSample.kproj +++ b/samples/ErrorHandlerSample/ErrorHandlerSample.kproj @@ -1,4 +1,4 @@ - + 14.0 @@ -12,6 +12,7 @@ 2.0 + 62671 - + \ No newline at end of file diff --git a/samples/RuntimeInfoPageSample/RuntimeInfoPageSample.kproj b/samples/RuntimeInfoPageSample/RuntimeInfoPageSample.kproj index 922df5d4c2..8c1b79c499 100644 --- a/samples/RuntimeInfoPageSample/RuntimeInfoPageSample.kproj +++ b/samples/RuntimeInfoPageSample/RuntimeInfoPageSample.kproj @@ -1,4 +1,4 @@ - + 14.0 @@ -12,6 +12,7 @@ 2.0 + 62670 - + \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ActivityContext.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ActivityContext.cs index 41833c3955..16b22fbc1a 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/ActivityContext.cs +++ b/src/Microsoft.AspNet.Diagnostics.Elm/ActivityContext.cs @@ -14,5 +14,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm public DateTimeOffset Time { get; set; } public bool IsCollapsed { get; set; } + + public bool RepresentsScope { get; set; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmLogger.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmLogger.cs index 9238d6d6e1..2e25edca93 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmLogger.cs +++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmLogger.cs @@ -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 }; } diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmPageMiddleware.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmPageMiddleware.cs index 020f7193e7..cf02d4abd3 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmPageMiddleware.cs +++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmPageMiddleware.cs @@ -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> 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(); diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/Views/RequestPage.cs b/src/Microsoft.AspNet.Diagnostics.Elm/Views/DetailsPage.cs similarity index 87% rename from src/Microsoft.AspNet.Diagnostics.Elm/Views/RequestPage.cs rename to src/Microsoft.AspNet.Diagnostics.Elm/Views/DetailsPage.cs index fbee9111ae..52d3684656 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/Views/RequestPage.cs +++ b/src/Microsoft.AspNet.Diagnostics.Elm/Views/DetailsPage.cs @@ -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, " \r\n "); -#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, "\r\n "); -#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(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(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(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(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, "\r\n \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 {

ASP.NET Logs

"); -#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("

Request Details

\r\n \r\n \r\n\r\n " + " \r\n \r\n \r\n \r\n \r\n \r\n " + " \r\n \r\n \r\n " + "\r\n \r\n \r\n \r\n \r\n " + " \r\n \r\n \r\n \r\n " + " "); -#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(" \r\n \r\n \r\n \r\n"); -#line 126 "RequestPage.cshtml" +#line 126 "DetailsPage.cshtml" } #line default @@ -463,27 +463,27 @@ td, th { WriteLiteral(" \r\n
Path"); -#line 91 "RequestPage.cshtml" +#line 91 "DetailsPage.cshtml" Write(context.Path); #line default #line hidden WriteLiteral("
Host"); -#line 95 "RequestPage.cshtml" +#line 95 "DetailsPage.cshtml" Write(context.Host); #line default #line hidden WriteLiteral("
Content Type"); -#line 99 "RequestPage.cshtml" +#line 99 "DetailsPage.cshtml" Write(context.ContentType); #line default #line hidden WriteLiteral("
Method"); -#line 103 "RequestPage.cshtml" +#line 103 "DetailsPage.cshtml" Write(context.Method); #line default #line hidden WriteLiteral("
Protocol"); -#line 107 "RequestPage.cshtml" +#line 107 "DetailsPage.cshtml" Write(context.Protocol); #line default @@ -428,13 +428,13 @@ td, th {
"); -#line 123 "RequestPage.cshtml" +#line 123 "DetailsPage.cshtml" Write(header.Key); #line default #line hidden WriteLiteral(""); -#line 124 "RequestPage.cshtml" +#line 124 "DetailsPage.cshtml" Write(string.Join(";", header.Value)); #line default #line hidden WriteLiteral("
\r\n <" + "/td>\r\n \r\n \r\n Status Code\r" + "\n "); -#line 133 "RequestPage.cshtml" +#line 133 "DetailsPage.cshtml" Write(context.StatusCode); #line default #line hidden WriteLiteral("\r\n \r\n \r\n User\r\n " + " "); -#line 137 "RequestPage.cshtml" +#line 137 "DetailsPage.cshtml" Write(context.User.Identity.Name); #line default #line hidden WriteLiteral("\r\n \r\n \r\n Claims\r\n " + " \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 { "); -#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(" \r\n " + " "); -#line 155 "RequestPage.cshtml" +#line 155 "DetailsPage.cshtml" Write(claim.Issuer); #line default #line hidden WriteLiteral("\r\n "); -#line 156 "RequestPage.cshtml" +#line 156 "DetailsPage.cshtml" Write(claim.Value); #line default #line hidden WriteLiteral("\r\n \r\n"); -#line 158 "RequestPage.cshtml" +#line 158 "DetailsPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n \r\n"); -#line 161 "RequestPage.cshtml" +#line 161 "DetailsPage.cshtml" } #line default @@ -541,27 +541,27 @@ td, th { WriteLiteral(" \r\n \r\n \r\n S" + "cheme\r\n "); -#line 166 "RequestPage.cshtml" +#line 166 "DetailsPage.cshtml" Write(context.Scheme); #line default #line hidden WriteLiteral("\r\n \r\n \r\n Query\r\n " + " "); -#line 170 "RequestPage.cshtml" +#line 170 "DetailsPage.cshtml" Write(context.Query.Value); #line default #line hidden WriteLiteral("\r\n \r\n \r\n Cookies\r\n " + " \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 { "); -#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(" \r\n " + " "); -#line 188 "RequestPage.cshtml" +#line 188 "DetailsPage.cshtml" Write(cookie.Key); #line default #line hidden WriteLiteral("\r\n "); -#line 189 "RequestPage.cshtml" +#line 189 "DetailsPage.cshtml" Write(string.Join(";", cookie.Value)); #line default #line hidden WriteLiteral("\r\n \r\n"); -#line 191 "RequestPage.cshtml" +#line 191 "DetailsPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n \r\n"); -#line 194 "RequestPage.cshtml" +#line 194 "DetailsPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n \r\n \r\n"); -#line 198 "RequestPage.cshtml" +#line 198 "DetailsPage.cshtml" } #line default #line hidden WriteLiteral("

Logs

\r\n
\r\n "); -#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(" (severityInt, 3210), false)); + WriteAttribute("value", Tuple.Create(" value=\"", 3500), Tuple.Create("\"", 3520), + Tuple.Create(Tuple.Create("", 3508), Tuple.Create(severityInt, 3508), false)); WriteLiteral(" selected=\"selected\">"); -#line 109 "LogPage.cshtml" +#line 113 "LogPage.cshtml" Write(severity); #line default #line hidden WriteLiteral("\r\n"); -#line 110 "LogPage.cshtml" +#line 114 "LogPage.cshtml" } else { @@ -483,16 +508,16 @@ tr:nth-child(2n) { #line hidden WriteLiteral(" (severityInt, 3359), false)); + WriteAttribute("value", Tuple.Create(" value=\"", 3649), Tuple.Create("\"", 3669), + Tuple.Create(Tuple.Create("", 3657), Tuple.Create(severityInt, 3657), false)); WriteLiteral(">"); -#line 113 "LogPage.cshtml" +#line 117 "LogPage.cshtml" Write(severity); #line default #line hidden WriteLiteral("\r\n"); -#line 114 "LogPage.cshtml" +#line 118 "LogPage.cshtml" } } @@ -500,8 +525,8 @@ tr:nth-child(2n) { #line hidden WriteLiteral(" \r\n (Model.Options.NamePrefix, 3492), false)); + WriteAttribute("value", Tuple.Create(" value=\"", 3782), Tuple.Create("\"", 3815), + Tuple.Create(Tuple.Create("", 3790), Tuple.Create(Model.Options.NamePrefix, 3790), false)); WriteLiteral(@" /> @@ -513,6 +538,7 @@ tr:nth-child(2n) { Path + Method Host Status Code Logs @@ -523,15 +549,16 @@ tr:nth-child(2n) { + "); -#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(" \r\n \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(" (requestPath, 4541), false)); - WriteAttribute("title", Tuple.Create(" title=\"", 4554), Tuple.Create("\"", 4585), - Tuple.Create(Tuple.Create("", 4562), Tuple.Create(activity.HttpInfo.Path, 4562), false)); + WriteLiteral(" \t(activityPath, 4886), false)); + WriteAttribute("title", Tuple.Create(" title=\"", 4900), Tuple.Create("\"", 4931), + Tuple.Create(Tuple.Create("", 4908), Tuple.Create(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("\r\n "); -#line 148 "LogPage.cshtml" +#line 154 "LogPage.cshtml" + Write(activity.HttpInfo.Method); + +#line default +#line hidden + WriteLiteral("\r\n "); +#line 155 "LogPage.cshtml" Write(activity.HttpInfo.Host); #line default #line hidden WriteLiteral("\r\n "); -#line 149 "LogPage.cshtml" +#line 156 "LogPage.cshtml" Write(activity.HttpInfo.StatusCode); #line default #line hidden WriteLiteral("\r\n"); -#line 150 "LogPage.cshtml" +#line 157 "LogPage.cshtml" + } + else if (activity.RepresentsScope) + { + +#line default +#line hidden + + WriteLiteral(" (activityPath, 5328), false)); + WriteAttribute("title", Tuple.Create(" title=\"", 5342), Tuple.Create("\"", 5370), + Tuple.Create(Tuple.Create("", 5350), Tuple.Create(activity.Root.State, 5350), false)); + WriteLiteral(">"); +#line 160 "LogPage.cshtml" + Write(activity.Root.State); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 161 "LogPage.cshtml" } else { @@ -586,14 +639,11 @@ tr:nth-child(2n) { #line default #line hidden - WriteLiteral(" "); -#line 153 "LogPage.cshtml" - Write(activity.Root.State); - -#line default -#line hidden - WriteLiteral("\r\n"); -#line 154 "LogPage.cshtml" + WriteLiteral(" (activityPath, 5540), false)); + WriteLiteral(">Non-scope Log\r\n"); +#line 165 "LogPage.cshtml" } @@ -604,39 +654,60 @@ tr:nth-child(2n) { - + - + - "); -#line 169 "LogPage.cshtml" +#line 179 "LogPage.cshtml" + + +#line default +#line hidden + +#line 179 "LogPage.cshtml" + + var counts = new Dictionary(); + counts["Critical"] = 0; + counts["Error"] = 0; + counts["Warning"] = 0; + counts["Information"] = 0; + counts["Verbose"] = 0; + + +#line default +#line hidden + + WriteLiteral("\r\n \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(" \r\n
Date Time Name Severity StateErrorError^
\r\n " + -" \r\n \r\n \r\n"); -#line 183 "LogPage.cshtml" + WriteLiteral(" \r\n \r\n \r\n " + +" "); +#line 202 "LogPage.cshtml" + Write(activity.Time.ToString("MM-dd-yyyy HH:mm:ss")); + +#line default +#line hidden + WriteLiteral("\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(" "); +#line 206 "LogPage.cshtml" + Write(kvp.Value); + +#line default +#line hidden + WriteLiteral(" "); +#line 206 "LogPage.cshtml" + Write(kvp.Key); + +#line default +#line hidden + WriteLiteral("v\r\n"); +#line 207 "LogPage.cshtml" + } + else + { + +#line default +#line hidden + + WriteLiteral(" "); +#line 210 "LogPage.cshtml" + Write(kvp.Value); + +#line default +#line hidden + WriteLiteral(" "); +#line 210 "LogPage.cshtml" + Write(kvp.Key); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 211 "LogPage.cshtml" + } + } + +#line default +#line hidden + + WriteLiteral(" \r\n \r\n " + +" \r\n \r\n \r\n" + +" \r\n"); +#line 219 "LogPage.cshtml" } #line default #line hidden - WriteLiteral(" \r\n\r\n"); + WriteLiteral(@" + + +"); } #pragma warning restore 1998 } diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/Views/LogPage.cshtml b/src/Microsoft.AspNet.Diagnostics.Elm/Views/LogPage.cshtml index 0b6aa0ea42..2490be69dd 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/Views/LogPage.cshtml +++ b/src/Microsoft.AspNet.Diagnostics.Elm/Views/LogPage.cshtml @@ -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 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 @@ ASP.NET Logs + + + +

@Resources.ErrorPageHtml_CompilationException

+ @if (Model.Options.ShowExceptionDetails) + { +
@errorDetail.Error.GetType().Name: @{ Output.Write(WebUtility.HtmlEncode(errorDetail.Error.Message).Replace("\r\n", "
").Replace("\r", "
").Replace("\n", "
")); }
+ } + else + { +

@Resources.ErrorPageHtml_EnableShowExceptions

+ } + @if (Model.Options.ShowExceptionDetails) + { +
+ @{ int tabIndex = 6; } +
+
    + @foreach (var frame in errorDetail.StackFrames) + { +
  • + @{ tabIndex++; } + @if (!string.IsNullOrEmpty(frame.ErrorDetails)) + { +

    @frame.ErrorDetails

    + } + else + { + if (string.IsNullOrEmpty(frame.File)) + { +

    @frame.Function

    + } + else + { +

    @frame.Function in @System.IO.Path.GetFileName(frame.File)

    + } + } + @if (frame.Line != 0 && frame.ContextCode.Any()) + { +
    + @if (frame.PreContextCode != null) + { +
      + @foreach (var line in frame.PreContextCode) + { +
    1. @line
    2. + } +
    + } +
      + @foreach (var line in frame.ContextCode) + { +
    1. @line
    2. + } +
    + @if (frame.PostContextCode != null) + { +
      + @foreach (var line in frame.PostContextCode) + { +
    1. @line
    2. + } +
    + } +
    + } +
  • + } +
+
+ } + + + diff --git a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs index a2826d6d32..ecb486deae 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs @@ -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(" (frame.PreContextLine, 5285), false)); + WriteAttribute("start", Tuple.Create(" start=\"", 5275), Tuple.Create("\"", 5304), + Tuple.Create(Tuple.Create("", 5283), Tuple.Create(frame.PreContextLine, 5283), false)); WriteLiteral(" class=\"collapsible\">\r\n"); #line 129 "ErrorPage.cshtml" @@ -530,22 +530,43 @@ using Views #line hidden WriteLiteral("\r\n (frame.Line, 5782), false)); - WriteLiteral(" class=\"highlight\">\r\n
  • "); + WriteAttribute("start", Tuple.Create(" start=\"", 5772), Tuple.Create("\"", 5791), + Tuple.Create(Tuple.Create("", 5780), Tuple.Create(frame.Line, 5780), false)); + WriteLiteral(" class=\"highlight\">\r\n"); #line 137 "ErrorPage.cshtml" - Write(frame.ContextCode); + #line default #line hidden - WriteLiteral("
  • \r\n\r\n"); + +#line 137 "ErrorPage.cshtml" + foreach (var line in frame.ContextCode) + { + +#line default +#line hidden + + WriteLiteral("
  • "); #line 139 "ErrorPage.cshtml" + Write(line); + +#line default +#line hidden + WriteLiteral("
  • \r\n"); +#line 140 "ErrorPage.cshtml" + } + +#line default +#line hidden + + WriteLiteral(" \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(" (frame.Line + 1, 6099), false)); + WriteAttribute("start", Tuple.Create(" start=\'", 6318), Tuple.Create("\'", 6343), + Tuple.Create(Tuple.Create("", 6326), Tuple.Create(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("
  • "); -#line 144 "ErrorPage.cshtml" +#line 148 "ErrorPage.cshtml" Write(line); #line default #line hidden WriteLiteral("
  • \r\n"); -#line 145 "ErrorPage.cshtml" +#line 149 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n"); -#line 147 "ErrorPage.cshtml" +#line 151 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n"); -#line 149 "ErrorPage.cshtml" +#line 153 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n"); -#line 151 "ErrorPage.cshtml" +#line 155 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n \r\n"); -#line 154 "ErrorPage.cshtml" +#line 158 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral(" \r\n \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("
    \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(" \r\n \r\n " + " \r\n \r\n \r\n \r\n \r\n " + " \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(" \r\n " + " \r\n \r\n \r\n"); -#line 179 "ErrorPage.cshtml" +#line 183 "ErrorPage.cshtml" } } @@ -691,7 +712,7 @@ using Views #line hidden WriteLiteral(" \r\n
    "); -#line 166 "ErrorPage.cshtml" +#line 170 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_VariableColumn); #line default #line hidden WriteLiteral(""); -#line 167 "ErrorPage.cshtml" +#line 171 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_ValueColumn); #line default #line hidden WriteLiteral("
    "); -#line 176 "ErrorPage.cshtml" +#line 180 "ErrorPage.cshtml" Write(kv.Key); #line default #line hidden WriteLiteral(""); -#line 177 "ErrorPage.cshtml" +#line 181 "ErrorPage.cshtml" Write(v); #line default #line hidden WriteLiteral("
    \r\n"); -#line 183 "ErrorPage.cshtml" +#line 187 "ErrorPage.cshtml" } else { @@ -700,27 +721,27 @@ using Views #line hidden WriteLiteral("

    "); -#line 186 "ErrorPage.cshtml" +#line 190 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_NoQueryStringData); #line default #line hidden WriteLiteral("

    \r\n"); -#line 187 "ErrorPage.cshtml" +#line 191 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral("
    \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("
    \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(" \r\n \r\n " + " \r\n \r\n \r\n \r\n \r\n " + " \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(" \r\n " + " \r\n \r\n \r\n"); -#line 242 "ErrorPage.cshtml" +#line 246 "ErrorPage.cshtml" } } @@ -830,7 +851,7 @@ using Views #line hidden WriteLiteral(" \r\n
    "); -#line 229 "ErrorPage.cshtml" +#line 233 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_VariableColumn); #line default #line hidden WriteLiteral(""); -#line 230 "ErrorPage.cshtml" +#line 234 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_ValueColumn); #line default #line hidden WriteLiteral("
    "); -#line 239 "ErrorPage.cshtml" +#line 243 "ErrorPage.cshtml" Write(kv.Key); #line default #line hidden WriteLiteral(""); -#line 240 "ErrorPage.cshtml" +#line 244 "ErrorPage.cshtml" Write(v); #line default #line hidden WriteLiteral("
    \r\n"); -#line 246 "ErrorPage.cshtml" +#line 250 "ErrorPage.cshtml" } else { @@ -839,27 +860,27 @@ using Views #line hidden WriteLiteral("

    "); -#line 249 "ErrorPage.cshtml" +#line 253 "ErrorPage.cshtml" Write(Resources.ErrorPageHtml_NoHeaderData); #line default #line hidden WriteLiteral("

    \r\n"); -#line 250 "ErrorPage.cshtml" +#line 254 "ErrorPage.cshtml" } #line default #line hidden WriteLiteral("
    \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: diff --git a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml index de7abfad3c..7a0075ac42 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml +++ b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml @@ -120,7 +120,7 @@

    @frame.Function in @System.IO.Path.GetFileName(frame.File)

    } - @if (frame.Line != 0 && frame.ContextCode != null) + @if (frame.Line != 0 && frame.ContextCode.Any()) {
    @if (frame.PreContextCode != null) @@ -134,7 +134,11 @@ }
      -
    1. @frame.ContextCode
    + @foreach (var line in frame.ContextCode) + { +
  • @line
  • + } + @if (frame.PostContextCode != null) { diff --git a/src/Microsoft.AspNet.Diagnostics/Views/StackFrame.cs b/src/Microsoft.AspNet.Diagnostics/Views/StackFrame.cs index 2b17068868..4a1ec2f513 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/StackFrame.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/StackFrame.cs @@ -39,11 +39,16 @@ namespace Microsoft.AspNet.Diagnostics.Views /// /// /// - public string ContextCode { get; set; } + public IEnumerable ContextCode { get; set; } /// /// /// public IEnumerable PostContextCode { get; set; } + + /// + /// Specific error details for this stack frame. + /// + public string ErrorDetails { get; set; } } } diff --git a/src/Microsoft.AspNet.Diagnostics/project.json b/src/Microsoft.AspNet.Diagnostics/project.json index c45eb89a56..d180b2787a 100644 --- a/src/Microsoft.AspNet.Diagnostics/project.json +++ b/src/Microsoft.AspNet.Diagnostics/project.json @@ -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" } }, diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/DatabaseErrorPageMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/DatabaseErrorPageMiddlewareTest.cs index 61516a7a97..4ff4d60d3d 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/DatabaseErrorPageMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/DatabaseErrorPageMiddlewareTest.cs @@ -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(); - services.AddInstance(new DbContextOptions().UseSqlServer(database.ConnectionString)); + + var contextOptions = new DbContextOptions(); + contextOptions.UseSqlServer(database.ConnectionString); + services.AddInstance(contextOptions); }); var options = DatabaseErrorPageOptions.ShowAll; @@ -268,9 +271,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests services.AddEntityFramework() .AddSqlServer(); - services.AddInstance( - new DbContextOptions() - .UseSqlServer(database.ConnectionString)); + var options = new DbContextOptions(); + options.UseSqlServer(database.ConnectionString); + + services.AddInstance(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(); + 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()) + { + 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(ILoggerProvider logProvider = null) where TContext : DbContext { @@ -351,9 +390,11 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests .AddSqlServer(); services.AddScoped(); - services.AddInstance( - new DbContextOptions() - .UseSqlServer(database.ConnectionString)); + + var options = new DbContextOptions(); + options.UseSqlServer(database.ConnectionString); + + services.AddInstance(options); }); app.UseDatabaseErrorPage(); diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/MigrationsEndPointMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/MigrationsEndPointMiddlewareTest.cs index 66fa99abc7..73db458229 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/MigrationsEndPointMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/MigrationsEndPointMiddlewareTest.cs @@ -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 => { diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/SqlServerTestStore.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/SqlServerTestStore.cs index d4752ab46f..9082d4b2bb 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/SqlServerTestStore.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/SqlServerTestStore.cs @@ -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(); } diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContext.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContext.cs index a8ecc378aa..5a322a7a5e 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContext.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContext.cs @@ -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; diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithMigrations.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithMigrations.cs index 5d59d57820..d2047fd0f4 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithMigrations.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithMigrations.cs @@ -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; diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithPendingModelChanges.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithPendingModelChanges.cs index cb98b4bcbf..e571d930ef 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithPendingModelChanges.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithPendingModelChanges.cs @@ -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 diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithSnapshotThatThrows.cs b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithSnapshotThatThrows.cs index f1c1fd1973..ff2b09354b 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithSnapshotThatThrows.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/TestModels/BloggingContextWithSnapshotThatThrows.cs @@ -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; diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/project.json b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/project.json index a064bdbca8..7b55cb635e 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Diagnostics.Entity.FunctionalTests/project.json @@ -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": { } diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json index 69fa4bca68..bca9f67fd0 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json +++ b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json @@ -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": { } diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/ElmMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/ElmMiddlewareTest.cs index 4e8a298fa7..8343b54910 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/ElmMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Tests/ElmMiddlewareTest.cs @@ -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().Object); contextMock - .Setup(c => c.Request.GetFormAsync(It.IsAny())) - .Returns(Task.FromResult(new Mock().Object)); + .Setup(c => c.Request.ReadFormAsync(It.IsAny())) + .Returns(Task.FromResult(new Mock().Object)); return contextMock; } diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/project.json b/test/Microsoft.AspNet.Diagnostics.Tests/project.json index 31e676c054..8d43ffb74b 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/project.json +++ b/test/Microsoft.AspNet.Diagnostics.Tests/project.json @@ -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" } }