diff --git a/Mvc.sln b/Mvc.sln index 830bd9f81e..eef6a57f11 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -51,8 +51,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TagHelpersWebSite", "test\W EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilesWebSite", "test\WebSites\FilesWebSite\FilesWebSite.csproj", "{0EF9860B-10D7-452F-B0F4-A405B88BEBB3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPageExecutionInstrumentationWebSite", "test\WebSites\RazorPageExecutionInstrumentationWebSite\RazorPageExecutionInstrumentationWebSite.csproj", "{2B2B9876-903C-4065-8D62-2EE832BBA106}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationModelWebSite", "test\WebSites\ApplicationModelWebSite\ApplicationModelWebSite.csproj", "{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.WebApiCompatShim", "src\Microsoft.AspNetCore.Mvc.WebApiCompatShim\Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj", "{23D30B8C-04B1-4577-A604-ED27EA1E4A0E}" @@ -334,16 +332,6 @@ Global {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|x86.ActiveCfg = Release|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|x86.ActiveCfg = Debug|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Any CPU.Build.0 = Release|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|x86.ActiveCfg = Release|Any CPU {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Any CPU.Build.0 = Debug|Any CPU {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -941,7 +929,6 @@ Global {C6304029-78C8-4604-99BE-2078DCA1DD36} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {6DB9B8D0-80F7-4E70-BBB0-0B4C04D79A47} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {0EF9860B-10D7-452F-B0F4-A405B88BEBB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {2B2B9876-903C-4065-8D62-2EE832BBA106} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {23D30B8C-04B1-4577-A604-ED27EA1E4A0E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {B2B7BC91-688E-4C1E-A71F-CE948D958DDF} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index a3d5754be1..917d2938cb 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -37,7 +37,6 @@ - diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorPageExecutionInstrumentationTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorPageExecutionInstrumentationTest.cs deleted file mode 100644 index b6e87cf1a5..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorPageExecutionInstrumentationTest.cs +++ /dev/null @@ -1,43 +0,0 @@ -// 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.Net.Http; -using System.Reflection; -using System.Threading.Tasks; -using RazorPageExecutionInstrumentationWebSite; -using Xunit; - -namespace Microsoft.AspNetCore.Mvc.FunctionalTests -{ - public class RazorPageExecutionInstrumentationTest : IClassFixture> - { - private static readonly Assembly _resourcesAssembly = - typeof(RazorPageExecutionInstrumentationTest).GetTypeInfo().Assembly; - - public RazorPageExecutionInstrumentationTest(MvcTestFixture fixture) - { - Client = fixture.CreateDefaultClient(); - } - - public HttpClient Client { get; } - - [Fact] - public async Task InstrumentedViews_RenderAsExpected() - { - // Arrange - var outputFile = "compiler/resources/RazorPageExecutionInstrumentationWebSite.Home.ViewWithPartial.html"; - var expectedContent = - await ResourceFile.ReadResourceAsync(_resourcesAssembly, outputFile, sourceFile: false); - - // Act - var content = await Client.GetStringAsync("http://localhost/Home/ViewWithPartial"); - - // Assert -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, content); -#else - Assert.Equal(expectedContent, content, ignoreLineEndingDifferences: true); -#endif - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/RazorPageExecutionInstrumentationWebSite.Home.ViewWithPartial.html b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/RazorPageExecutionInstrumentationWebSite.Home.ViewWithPartial.html deleted file mode 100644 index 81cbd4fb84..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/compiler/resources/RazorPageExecutionInstrumentationWebSite.Home.ViewWithPartial.html +++ /dev/null @@ -1,20 +0,0 @@ -/Views/_ViewStart.cshtml: Non-literal at 96 contains 16 characters. -/Views/_ViewStart.cshtml: Literal at 112 contains 2 characters. -/Views/Home/ViewWithPartial.cshtml: Literal at 0 contains 27 characters. -/Views/Home/ViewWithPartial.cshtml: Non-literal at 28 contains 39 characters. -/Views/Home/_PartialView.cshtml: Literal at 31 contains 2 characters. -/Views/Home/_PartialView.cshtml: Literal at 33 contains 8 characters. -/Views/Home/_PartialView.cshtml: Non-literal at 41 contains 4 characters. -/Views/Home/_PartialView.cshtml: Literal at 45 contains 1 characters. -/Views/Home/_PartialView.cshtml: Literal at 46 contains 20 characters. -/Views/Home/ViewWithPartial.cshtml: Literal at 67 contains 2 characters. -/Views/Home/_PartialView.cshtml: Literal at 31 contains 2 characters. -/Views/Home/_PartialView.cshtml: Literal at 33 contains 8 characters. -/Views/Home/_PartialView.cshtml: Non-literal at 41 contains 4 characters. -/Views/Home/_PartialView.cshtml: Literal at 45 contains 1 characters. -/Views/Home/_PartialView.cshtml: Literal at 46 contains 20 characters. -/Views/_Layout.cshtml: Literal at 0 contains 7 characters. -/Views/_Layout.cshtml: Non-literal at 8 contains 12 characters. -/Views/_Layout.cshtml: Literal at 20 contains 2 characters. -/Views/_Layout.cshtml: Non-literal at 23 contains 12 characters. -/Views/_Layout.cshtml: Literal at 35 contains 10 characters. diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/HomeController.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/HomeController.cs deleted file mode 100644 index 3f23b8f768..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/HomeController.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 Microsoft.AspNetCore.Mvc; - -namespace RazorPageExecutionInstrumentationWebSite -{ - public class HomeController : Controller - { - public ActionResult ViewWithPartial() - { - return View(); - } - } -} \ No newline at end of file diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageDiagnosticListener.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageDiagnosticListener.cs deleted file mode 100644 index 30ca586d01..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageDiagnosticListener.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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.IO; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DiagnosticAdapter; - -namespace RazorPageExecutionInstrumentationWebSite -{ - public class RazorPageDiagnosticListener - { - public static readonly object WriterKey = new object(); - - [DiagnosticName("Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext")] - public virtual void OnBeginPageInstrumentationContext( - HttpContext httpContext, - string path, - int position, - int length, - bool isLiteral) - { - var literal = isLiteral ? "Literal" : "Non-literal"; - var text = $"{path}: {literal} at {position} contains {length} characters."; - - var writer = (TextWriter)httpContext.Items[WriterKey]; - writer.WriteLine(text); - } - } -} diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj deleted file mode 100644 index 8b6090fc0f..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(StandardTestWebsiteTfms) - - - - - - - - - - - diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs deleted file mode 100644 index 76b1886b01..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs +++ /dev/null @@ -1,61 +0,0 @@ -// 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.Diagnostics; -using System.IO; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.Extensions.DependencyInjection; - -namespace RazorPageExecutionInstrumentationWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - // Normalize line endings to avoid changes in instrumentation locations between systems. - services.AddTransient(); - - // Add MVC services to the services container. - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - var listener = new RazorPageDiagnosticListener(); - var diagnosticSource = app.ApplicationServices.GetRequiredService(); - diagnosticSource.SubscribeWithAdapter(listener); - - app.Use(async (context, next) => - { - using (var writer = new StreamWriter(context.Response.Body)) - { - context.Items[RazorPageDiagnosticListener.WriterKey] = writer; - context.Response.Body = Stream.Null; - await next(); - } - }); - - // Add MVC to the request pipeline - app.UseMvcWithDefaultRoute(); - } - - public static void Main(string[] args) - { - var host = CreateWebHostBuilder(args) - .Build(); - - host.Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - new WebHostBuilder() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseStartup() - .UseKestrel() - .UseIISIntegration(); - } -} - diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/TestRazorCompilationService.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/TestRazorCompilationService.cs deleted file mode 100644 index d4171804fb..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/TestRazorCompilationService.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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.IO; -using System.Text; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc.Razor.Internal; -using Microsoft.AspNetCore.Razor.Language; - -namespace RazorPageExecutionInstrumentationWebSite -{ - public class TestRazorProjectFileSystem : FileProviderRazorProjectFileSystem - { - public TestRazorProjectFileSystem(IRazorViewEngineFileProviderAccessor fileProviderAccessor, IHostingEnvironment hostingEnvironment) - : base(fileProviderAccessor, hostingEnvironment) - { - } - - public override RazorProjectItem GetItem(string path) - { - var item = (FileProviderRazorProjectItem)base.GetItem(path); - return new TestRazorProjectItem(item); - } - - private class TestRazorProjectItem : FileProviderRazorProjectItem - { - public TestRazorProjectItem(FileProviderRazorProjectItem projectItem) - : base(projectItem.FileInfo, projectItem.BasePath, projectItem.FilePath, projectItem.RelativePhysicalPath) - { - } - - public override Stream Read() - { - // Normalize line endings to '\r\n' (CRLF). This removes core.autocrlf, core.eol, core.safecrlf, and - // .gitattributes from the equation and treats "\r\n" and "\n" as equivalent. Does not handle - // some line endings like "\r" but otherwise ensures checksums and line mappings are consistent. - string text; - using (var streamReader = new StreamReader(base.Read())) - { - text = streamReader.ReadToEnd().Replace("\r", "").Replace("\n", "\r\n"); - } - - var bytes = Encoding.UTF8.GetBytes(text); - return new MemoryStream(bytes); - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/ViewWithPartial.cshtml b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/ViewWithPartial.cshtml deleted file mode 100644 index 8f42baf024..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/ViewWithPartial.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -view-with-partial-content -@await Html.PartialAsync("_PartialView") -@{ -await Html.RenderPartialAsync("_PartialView"); -} \ No newline at end of file diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/_PartialView.cshtml b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/_PartialView.cshtml deleted file mode 100644 index 3b945a4613..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/Home/_PartialView.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@{ - var cls = "class"; -} -

partial-content

\ No newline at end of file diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_Layout.cshtml b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_Layout.cshtml deleted file mode 100644 index 23e469ccc9..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_Layout.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -
-@int.MaxValue -@RenderBody() -
diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_ViewStart.cshtml b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_ViewStart.cshtml deleted file mode 100644 index 3b3abdacaa..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Views/_ViewStart.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@{ - Layout = "/Views/_Layout.cshtml"; - var viewStartMessage = "viewstart-content"; -} -@viewStartMessage diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/readme.md b/test/WebSites/RazorPageExecutionInstrumentationWebSite/readme.md deleted file mode 100644 index b5de53569b..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -RazorPageExecutionInstrumentationWebSite -=== - -This web site is used for functional testing of page instrumentation.