diff --git a/samples/DeveloperExceptionPageSample/project.json b/samples/DeveloperExceptionPageSample/project.json index 44c8cea4f1..bb6948f961 100644 --- a/samples/DeveloperExceptionPageSample/project.json +++ b/samples/DeveloperExceptionPageSample/project.json @@ -7,10 +7,10 @@ "emitEntryPoint": true }, "commands": { - "web": "DeveloperExceptionPageSample" + "web": "DeveloperExceptionPageSample" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "dnx451": { }, + "dnxcore50": { } } } diff --git a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoExtensions.cs b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoExtensions.cs index 8c49249547..ea28439530 100644 --- a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoExtensions.cs +++ b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoExtensions.cs @@ -43,12 +43,11 @@ namespace Microsoft.AspNet.Builder throw new ArgumentNullException(nameof(configureOptions)); } - var libraryManager = app.ApplicationServices.GetService(typeof(ILibraryManager)) as ILibraryManager; var runtimeEnvironment = app.ApplicationServices.GetService(typeof(IRuntimeEnvironment)) as IRuntimeEnvironment; var options = new RuntimeInfoPageOptions(); configureOptions(options); - return app.Use(next => new RuntimeInfoMiddleware(next, options, libraryManager, runtimeEnvironment).Invoke); + return app.Use(next => new RuntimeInfoMiddleware(next, options, runtimeEnvironment).Invoke); } public static IApplicationBuilder UseRuntimeInfoPage( @@ -64,10 +63,8 @@ namespace Microsoft.AspNet.Builder throw new ArgumentNullException(nameof(options)); } - var libraryManager = app.ApplicationServices.GetService(typeof(ILibraryManager)) as ILibraryManager; var runtimeEnvironment = app.ApplicationServices.GetService(typeof(IRuntimeEnvironment)) as IRuntimeEnvironment; - - return app.Use(next => new RuntimeInfoMiddleware(next, options, libraryManager, runtimeEnvironment).Invoke); + return app.Use(next => new RuntimeInfoMiddleware(next, options, runtimeEnvironment).Invoke); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoMiddleware.cs b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoMiddleware.cs index cb76df8b4d..dcb8ccdbd5 100644 --- a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoMiddleware.cs +++ b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/RuntimeInfoMiddleware.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNet.Builder; using Microsoft.AspNet.Diagnostics.Views; using Microsoft.AspNet.Http; using Microsoft.Extensions.PlatformAbstractions; @@ -17,7 +16,6 @@ namespace Microsoft.AspNet.Diagnostics { private readonly RequestDelegate _next; private readonly RuntimeInfoPageOptions _options; - private readonly ILibraryManager _libraryManager; private readonly IRuntimeEnvironment _runtimeEnvironment; /// @@ -28,7 +26,6 @@ namespace Microsoft.AspNet.Diagnostics public RuntimeInfoMiddleware( RequestDelegate next, RuntimeInfoPageOptions options, - ILibraryManager libraryManager, IRuntimeEnvironment runtimeEnvironment) { if (next == null) @@ -41,11 +38,6 @@ namespace Microsoft.AspNet.Diagnostics throw new ArgumentNullException(nameof(options)); } - if (libraryManager == null) - { - throw new ArgumentNullException(nameof(libraryManager)); - } - if (runtimeEnvironment == null) { throw new ArgumentNullException(nameof(runtimeEnvironment)); @@ -53,7 +45,6 @@ namespace Microsoft.AspNet.Diagnostics _next = next; _options = options; - _libraryManager = libraryManager; _runtimeEnvironment = runtimeEnvironment; } @@ -78,7 +69,6 @@ namespace Microsoft.AspNet.Diagnostics internal RuntimeInfoPageModel CreateRuntimeInfoModel() { var model = new RuntimeInfoPageModel(); - model.References = _libraryManager.GetLibraries(); model.Version = _runtimeEnvironment.RuntimeVersion; model.OperatingSystem = _runtimeEnvironment.OperatingSystem; model.RuntimeType = _runtimeEnvironment.RuntimeType; diff --git a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cs b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cs index 8c9d109921..5e3b3f3031 100644 --- a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cs @@ -81,8 +81,8 @@ WriteAttributeValue("", 456, CultureInfo.CurrentUICulture.TwoLetterISOLanguageNa #line default #line hidden - WriteLiteral("\r\n \r" + -"\n\r\n\r\n

"); + WriteLiteral("\r\n " + +"\r\n\r\n\r\n

"); #line 30 "RuntimeInfoPage.cshtml" Write(Resources.RuntimeInfoPage_Environment); @@ -136,135 +136,7 @@ WriteAttributeValue("", 456, CultureInfo.CurrentUICulture.TwoLetterISOLanguageNa #line default #line hidden - WriteLiteral("

\r\n\r\n

"); -#line 39 "RuntimeInfoPage.cshtml" - Write(Resources.RuntimeInfoPage_Packages); - -#line default -#line hidden - WriteLiteral("

\r\n"); -#line 40 "RuntimeInfoPage.cshtml" - - -#line default -#line hidden - -#line 40 "RuntimeInfoPage.cshtml" - if (@Resources.RuntimeInfoPage_Packages == null) - { - -#line default -#line hidden - - WriteLiteral("

"); -#line 42 "RuntimeInfoPage.cshtml" - Write(Resources.RuntimeInfoPage_PackagesFail); - -#line default -#line hidden - WriteLiteral("

\r\n"); -#line 43 "RuntimeInfoPage.cshtml" - } - else - { - -#line default -#line hidden - - WriteLiteral(" \r\n \r\n \r\n <" + -"th>"); -#line 49 "RuntimeInfoPage.cshtml" - Write(Resources.RuntimeInfoPage_PackageNameColumnName); - -#line default -#line hidden - WriteLiteral("\r\n \r\n \r\n \r\n \r\n \r\n"); -#line 55 "RuntimeInfoPage.cshtml" - - -#line default -#line hidden - -#line 55 "RuntimeInfoPage.cshtml" - bool even = false; - -#line default -#line hidden - - WriteLiteral(" "); -#line 56 "RuntimeInfoPage.cshtml" - foreach (var package in Model.References.OrderBy(package => package.Name.ToLowerInvariant())) - { - -#line default -#line hidden - - WriteLiteral(" \r\n \r\n \r\n \r\n"); -#line 63 "RuntimeInfoPage.cshtml" - - -#line default -#line hidden - -#line 63 "RuntimeInfoPage.cshtml" - even = !even; - -#line default -#line hidden - -#line 63 "RuntimeInfoPage.cshtml" - - } - -#line default -#line hidden - - WriteLiteral(" \r\n
"); -#line 50 "RuntimeInfoPage.cshtml" - Write(Resources.RuntimeInfoPage_PackageVersionColumnName); - -#line default -#line hidden - WriteLiteral(""); -#line 51 "RuntimeInfoPage.cshtml" - Write(Resources.RuntimeInfoPage_PackagePathColumnName); - -#line default -#line hidden - WriteLiteral("
"); -#line 59 "RuntimeInfoPage.cshtml" - Write(package.Name); - -#line default -#line hidden - WriteLiteral(""); -#line 60 "RuntimeInfoPage.cshtml" - Write(package.Version); - -#line default -#line hidden - WriteLiteral(""); -#line 61 "RuntimeInfoPage.cshtml" - Write(package.Path); - -#line default -#line hidden - WriteLiteral("
\r\n"); -#line 67 "RuntimeInfoPage.cshtml" - } - -#line default -#line hidden - - WriteLiteral("\r\n\r\n"); + WriteLiteral("

\r\n\r\n\r\n"); } #pragma warning restore 1998 } diff --git a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cshtml b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cshtml index 12eabdbb0e..23d8fb07d5 100644 --- a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cshtml +++ b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPage.cshtml @@ -23,7 +23,7 @@ @Resources.RuntimeInfoPage_Title @@ -35,35 +35,5 @@

@Resources.RuntimeInfoPage_RuntimeArchitecture @(string.IsNullOrWhiteSpace(Model.RuntimeArchitecture) ? Resources.RuntimeInfoPage_RuntimeArchitectureFail : Model.RuntimeArchitecture)

@Resources.RuntimeInfoPage_RuntimeType @(string.IsNullOrWhiteSpace(Model.RuntimeType) ? Resources.RuntimeInfoPage_RuntimeTypeFail : Model.RuntimeType)

- -

@Resources.RuntimeInfoPage_Packages

- @if (@Resources.RuntimeInfoPage_Packages == null) - { -

@Resources.RuntimeInfoPage_PackagesFail

- } - else - { - - - - - - - - - - @{ bool even = false; } - @foreach (var package in Model.References.OrderBy(package => package.Name.ToLowerInvariant())) - { - - - - - - @{ even = !even; } - } - -
@Resources.RuntimeInfoPage_PackageNameColumnName@Resources.RuntimeInfoPage_PackageVersionColumnName@Resources.RuntimeInfoPage_PackagePathColumnName
@package.Name@package.Version@package.Path
- } diff --git a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPageModel.cs b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPageModel.cs index 8d9ac08b42..04705bfc20 100644 --- a/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPageModel.cs +++ b/src/Microsoft.AspNet.Diagnostics/RuntimeInfo/Views/RuntimeInfoPageModel.cs @@ -1,9 +1,6 @@ // Copyright (c) .NET Foundation. 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.Extensions.PlatformAbstractions; - namespace Microsoft.AspNet.Diagnostics.Views { public class RuntimeInfoPageModel @@ -15,7 +12,5 @@ namespace Microsoft.AspNet.Diagnostics.Views public string RuntimeArchitecture { get; internal set; } public string RuntimeType { get; internal set; } - - public IEnumerable References { get; internal set; } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/RuntimeInfoMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/RuntimeInfoMiddlewareTest.cs index a1ea6b3bfc..be616ea09c 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/RuntimeInfoMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Tests/RuntimeInfoMiddlewareTest.cs @@ -31,14 +31,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests public void CreateRuntimeInfoModel_GetsTheVersionAndAllPackages() { // Arrage - var libraries = new[] { - new Library("LibInfo1", string.Empty, "Path1", string.Empty, Enumerable.Empty(), Enumerable.Empty()), - new Library("LibInfo2", string.Empty, "Path2", string.Empty, Enumerable.Empty(), Enumerable.Empty()) - }; - - var libraryManagerMock = new Mock(MockBehavior.Strict); - libraryManagerMock.Setup(l => l.GetLibraries()).Returns(libraries); - var runtimeEnvironmentMock = new Mock(MockBehavior.Strict); runtimeEnvironmentMock.Setup(r => r.OperatingSystem).Returns("Windows"); runtimeEnvironmentMock.Setup(r => r.RuntimeArchitecture).Returns("x64"); @@ -53,7 +45,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests var middleware = new RuntimeInfoMiddleware( next, new RuntimeInfoPageOptions(), - libraryManagerMock.Object, runtimeEnvironmentMock.Object); // Act @@ -64,14 +55,12 @@ namespace Microsoft.AspNet.Diagnostics.Tests Assert.Equal("Windows", model.OperatingSystem); Assert.Equal("clr", model.RuntimeType); Assert.Equal("x64", model.RuntimeArchitecture); - Assert.Same(libraries, model.References); } [Fact] public async void Invoke_WithNonMatchingPath_IgnoresRequest() { // Arrange - var libraryManagerMock = new Mock(MockBehavior.Strict); var runtimeEnvironmentMock = new Mock(MockBehavior.Strict); RequestDelegate next = _ => @@ -82,7 +71,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests var middleware = new RuntimeInfoMiddleware( next, new RuntimeInfoPageOptions(), - libraryManagerMock.Object, runtimeEnvironmentMock.Object); var contextMock = new Mock(MockBehavior.Strict); @@ -101,12 +89,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests public async void Invoke_WithMatchingPath_ReturnsInfoPage() { // Arrange - var libraryManagerMock = new Mock(MockBehavior.Strict); - libraryManagerMock.Setup(l => l.GetLibraries()).Returns(new[] { - new Library("LibInfo1", "1.0.0-beta1", "Path1", string.Empty, Enumerable.Empty(), Enumerable.Empty()), - new Library("LibInfo2", "1.0.0-beta2", "Path2", string.Empty, Enumerable.Empty(), Enumerable.Empty()) - }); - var runtimeEnvironmentMock = new Mock(MockBehavior.Strict); runtimeEnvironmentMock.Setup(r => r.OperatingSystem).Returns("Windows"); runtimeEnvironmentMock.Setup(r => r.RuntimeArchitecture).Returns("x64"); @@ -121,7 +103,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests var middleware = new RuntimeInfoMiddleware( next, new RuntimeInfoPageOptions(), - libraryManagerMock.Object, runtimeEnvironmentMock.Object); var buffer = new byte[4096]; @@ -148,12 +129,6 @@ namespace Microsoft.AspNet.Diagnostics.Tests Assert.Contains("

Operating System: Windows

", response); Assert.Contains("

Runtime Architecture: x64

", response); Assert.Contains("

Runtime Type: clr

", response); - Assert.Contains("LibInfo1", response); - Assert.Contains("1.0.0-beta1", response); - Assert.Contains("Path1", response); - Assert.Contains("LibInfo2", response); - Assert.Contains("1.0.0-beta2", response); - Assert.Contains("Path2", response); } } }