diff --git a/.gitignore b/.gitignore index 8bc217058d..52351df12f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ nuget.exe *DS_Store *.ncrunchsolution *.*sdf -*.ipch \ No newline at end of file +*.ipch +*.sln.ide \ No newline at end of file diff --git a/DiagnosticsPages.sln b/DiagnosticsPages.sln index 3bb0a67b81..87fd04d83a 100644 --- a/DiagnosticsPages.sln +++ b/DiagnosticsPages.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30327.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.21628.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{509A6F36-AD80-4A18-B5B1-717D38DFF29D}" EndProject @@ -13,6 +13,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Diagnostic EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ErrorPageSample", "samples\ErrorPageSample\ErrorPageSample.kproj", "{589AC17F-9455-4764-8F82-FCD2AE58DA14}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PageGenerator", "src\PageGenerator\PageGenerator.kproj", "{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,6 +53,15 @@ Global {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Mixed Platforms.Build.0 = Release|x86 {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|x86.ActiveCfg = Release|x86 {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|x86.Build.0 = Release|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Any CPU.ActiveCfg = Debug|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|x86.ActiveCfg = Debug|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|x86.Build.0 = Debug|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Any CPU.ActiveCfg = Release|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.Build.0 = Release|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.ActiveCfg = Release|x86 + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -59,5 +70,6 @@ Global {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416} = {ACAA0157-A8C4-4152-93DE-90CCDF304087} {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D} {589AC17F-9455-4764-8F82-FCD2AE58DA14} = {ACAA0157-A8C4-4152-93DE-90CCDF304087} + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D} EndGlobalSection EndGlobal diff --git a/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs b/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs index 10f9fdecac..774b9d8bdf 100644 --- a/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs +++ b/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Diagnostics { try { - DisplayException(context, ex); + await DisplayException(context, ex); return; } catch (Exception) @@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Diagnostics } // Assumes the response headers have not been sent. If they have, still attempt to write to the body. - private void DisplayException(HttpContext context, Exception ex) + private async Task DisplayException(HttpContext context, Exception ex) { var request = context.Request; @@ -103,7 +103,7 @@ namespace Microsoft.AspNet.Diagnostics }*/ var errorPage = new ErrorPage() { Model = model }; - errorPage.Execute(context); + await errorPage.ExecuteAsync(context); } private IEnumerable GetErrorDetails(Exception ex, bool showSource) diff --git a/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj b/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj index 896a7111a0..6749d006c1 100644 --- a/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj +++ b/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj @@ -20,13 +20,10 @@ - - - diff --git a/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs b/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs index bfcd2c93ee..934bf7096b 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.IO; using System.Net; +using System.Threading.Tasks; namespace Microsoft.AspNet.Diagnostics.Views { @@ -37,20 +38,20 @@ namespace Microsoft.AspNet.Diagnostics.Views /// Execute an individual request /// /// - public void Execute(HttpContext context) + public async Task ExecuteAsync(HttpContext context) { Context = context; Request = Context.Request; Response = Context.Response; Output = new StreamWriter(Response.Body); - Execute(); + await ExecuteAsync(); Output.Dispose(); } /// /// Execute an individual request /// - public abstract void Execute(); + public abstract Task ExecuteAsync(); /// /// Write the given value directly to the output diff --git a/src/Microsoft.AspNet.Diagnostics/Views/DiagnosticsPage.cs b/src/Microsoft.AspNet.Diagnostics/Views/DiagnosticsPage.cs index cd293e7b86..86971816a6 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/DiagnosticsPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/DiagnosticsPage.cs @@ -1,38 +1,29 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18213 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ +namespace Microsoft.AspNet.Diagnostics.Views +{ +#line 1 "DiagnosticsPage.cshtml" +using System -namespace Microsoft.AspNet.Diagnostics.Views { - - #line 1 "DiagnosticsPage.cshtml" - using System; - - #line default - #line hidden - - #line 2 "DiagnosticsPage.cshtml" - using System.Globalization; - - #line default - #line hidden - - - public class DiagnosticsPage : Microsoft.AspNet.Diagnostics.Views.BaseView { - +#line default #line hidden - - public DiagnosticsPage() { + ; +#line 2 "DiagnosticsPage.cshtml" +using System.Globalization + +#line default +#line hidden + ; + using System.Threading.Tasks; + + public class DiagnosticsPage : Microsoft.AspNet.Diagnostics.Views.BaseView + { + #line hidden + public DiagnosticsPage() + { } - - public override void Execute() { - - #line 3 "DiagnosticsPage.cshtml" + + public override async Task ExecuteAsync() + { +#line 3 "DiagnosticsPage.cshtml" Response.ContentType = "text/html"; string error = Request.Query.Get("error"); @@ -41,93 +32,70 @@ namespace Microsoft.AspNet.Diagnostics.Views { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "User requested error '{0}'", error)); } - - #line default - #line hidden -WriteLiteral("\r\n\r\n\r\n