Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit 0a977d8

Browse files
committed
More cleanup
1 parent ca8e1a0 commit 0a977d8

File tree

13 files changed

+14
-382
lines changed

13 files changed

+14
-382
lines changed

build/dependencies.props

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
<MicrosoftAspNetCoreJsonPatchPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreJsonPatchPackageVersion>
4141
<MicrosoftAspNetCoreLocalizationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreLocalizationPackageVersion>
4242
<MicrosoftAspNetCoreLocalizationRoutingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreLocalizationRoutingPackageVersion>
43-
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
4443
<MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRangeHelperSourcesPackageVersion>
45-
<MicrosoftAspNetCoreRazorLanguagePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorLanguagePackageVersion>
4644
<MicrosoftAspNetCoreRazorRuntimePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorRuntimePackageVersion>
4745
<MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorTagHelpersTestingSourcesPackageVersion>
4846
<MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion>

src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public CompiledViewDescriptor(RazorCompiledItem item, RazorViewAttribute attribu
5151
// later.
5252
ExpirationTokens = Array.Empty<IChangeToken>();
5353
RelativePath = ViewPath.NormalizePath(item?.Identifier ?? attribute.Path);
54-
IsPrecompiled = true;
5554
}
5655

5756
/// <summary>
@@ -72,11 +71,6 @@ public CompiledViewDescriptor(RazorCompiledItem item, RazorViewAttribute attribu
7271
/// </summary>
7372
public IList<IChangeToken> ExpirationTokens { get; set; }
7473

75-
/// <summary>
76-
/// Gets a value that determines if the view is precompiled.
77-
/// </summary>
78-
public bool IsPrecompiled { get; set; }
79-
8074
/// <summary>
8175
/// Gets the <see cref="RazorCompiledItem"/> descriptor for this view.
8276
/// </summary>

src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public void PopulateFeature(IEnumerable<ApplicationPart> parts, ViewsFeature fea
5050
ExpirationTokens = Array.Empty<IChangeToken>(),
5151
RelativePath = relativePath,
5252
ViewAttribute = attribute,
53-
IsPrecompiled = true,
5453
};
5554

5655
feature.ViewDescriptors.Add(viewDescriptor);

src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
repositoryUrl=$(RepositoryUrl);
4242
repositoryCommit=$(RepositoryCommit);
4343
targetframework=$(TargetFramework);
44-
MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion=$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion);
4544
MicrosoftAspNetCoreRazorRuntimePackageVersion=$(MicrosoftAspNetCoreRazorRuntimePackageVersion);
4645
MicrosoftCodeAnalysisRazorPackageVersion=$(MicrosoftCodeAnalysisRazorPackageVersion);
4746
MicrosoftCodeAnalysisCSharpPackageVersion=$(MicrosoftCodeAnalysisCSharpPackageVersion);

src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.nuspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<dependencies>
1717
<group targetFramework=".NETStandard2.0">
1818
<dependency id="Microsoft.AspNetCore.Mvc.ViewFeatures" version="$version$" exclude="Build,Analyzers" />
19-
<dependency id="Microsoft.AspNetCore.Mvc.Razor.Extensions" version="$MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion$" exclude="Build,Analyzers" />
2019
<dependency id="Microsoft.AspNetCore.Razor.Runtime" version="$MicrosoftAspNetCoreRazorRuntimePackageVersion$" exclude="Build,Analyzers" />
2120
<dependency id="Microsoft.CodeAnalysis.CSharp" version="$MicrosoftCodeAnalysisCSharpPackageVersion$" exclude="Build,Analyzers" />
2221
<dependency id="Microsoft.CodeAnalysis.Razor" version="$MicrosoftCodeAnalysisRazorPackageVersion$" exclude="Build,Analyzers" />
@@ -25,7 +24,6 @@
2524
</group>
2625
<group targetFramework=".NETFramework4.6.1">
2726
<dependency id="Microsoft.AspNetCore.Mvc.ViewFeatures" version="$version$" exclude="Build,Analyzers" />
28-
<dependency id="Microsoft.AspNetCore.Mvc.Razor.Extensions" version="$MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion$" exclude="Build,Analyzers" />
2927
<dependency id="Microsoft.AspNetCore.Razor.Runtime" version="$MicrosoftAspNetCoreRazorRuntimePackageVersion$" exclude="Build,Analyzers" />
3028
<dependency id="Microsoft.CodeAnalysis.CSharp" version="$MicrosoftCodeAnalysisCSharpPackageVersion$" exclude="Build,Analyzers" />
3129
<dependency id="Microsoft.CodeAnalysis.Razor" version="$MicrosoftCodeAnalysisRazorPackageVersion$" exclude="Build,Analyzers" />

src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,6 @@ internal ViewLocationCacheResult CreateCacheResult(
416416
var viewStartPages = isMainPage ?
417417
GetViewStartPages(viewDescriptor.RelativePath, expirationTokens) :
418418
Array.Empty<ViewLocationCacheItem>();
419-
if (viewDescriptor.IsPrecompiled)
420-
{
421-
_logger.PrecompiledViewFound(relativePath);
422-
}
423419

424420
return new ViewLocationCacheResult(
425421
new ViewLocationCacheItem(factoryResult.RazorPageFactory, relativePath),

src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,15 @@
5353
"TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions",
5454
"MemberId": "public System.Collections.Generic.IList<Microsoft.Extensions.FileProviders.IFileProvider> get_FileProviders()",
5555
"Kind": "Removal"
56+
},
57+
{
58+
"TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.CompiledViewDescriptor",
59+
"MemberId": "public System.Boolean get_IsPrecompiled()",
60+
"Kind": "Removal"
61+
},
62+
{
63+
"TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.Compilation.CompiledViewDescriptor",
64+
"MemberId": "public System.Void set_IsPrecompiled(System.Boolean value)",
65+
"Kind": "Removal"
5666
}
5767
]

src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ private IEnumerable<CompiledViewDescriptor> GetViewDescriptors(ApplicationPartMa
7070
continue;
7171
}
7272

73-
if (!viewDescriptor.IsPrecompiled)
74-
{
75-
continue;
76-
}
77-
7873
if (IsRazorPage(viewDescriptor))
7974
{
8075
yield return viewDescriptor;

test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineTest.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
using Microsoft.AspNetCore.Hosting;
99
using Microsoft.AspNetCore.Http;
1010
using Microsoft.AspNetCore.Mvc.Abstractions;
11-
using Microsoft.AspNetCore.Mvc.Infrastructure;
1211
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
1312
using Microsoft.AspNetCore.Mvc.Routing;
1413
using Microsoft.AspNetCore.Mvc.ViewEngines;
15-
using Microsoft.AspNetCore.Razor.Language;
1614
using Microsoft.AspNetCore.Routing;
1715
using Microsoft.AspNetCore.Testing;
1816
using Microsoft.Extensions.Caching.Memory;
19-
using Microsoft.Extensions.FileProviders;
2017
using Microsoft.Extensions.Logging.Abstractions;
21-
using Microsoft.Extensions.Logging.Testing;
2218
using Microsoft.Extensions.Options;
2319
using Microsoft.Extensions.Primitives;
2420
using Microsoft.Extensions.WebEncoders.Testing;
@@ -1307,38 +1303,6 @@ public void FindPage_LooksForPages_UsesRouteValuesAsFallback()
13071303
Assert.Equal(expected, result.SearchedLocations);
13081304
}
13091305

1310-
[Fact]
1311-
public void CreateCacheResult_LogsPrecompiledViewFound()
1312-
{
1313-
// Arrange
1314-
var sink = new TestSink();
1315-
var loggerFactory = new TestLoggerFactory(sink, enabled: true);
1316-
1317-
var relativePath = "/Views/Foo/details.cshtml";
1318-
var factoryResult = GetPageFactoryResult(() => Mock.Of<IRazorPage>());
1319-
factoryResult.ViewDescriptor.IsPrecompiled = true;
1320-
var pageFactory = new Mock<IRazorPageFactoryProvider>();
1321-
pageFactory
1322-
.Setup(p => p.CreateFactory(relativePath))
1323-
.Returns(factoryResult)
1324-
.Verifiable();
1325-
1326-
var viewEngine = new RazorViewEngine(
1327-
pageFactory.Object,
1328-
Mock.Of<IRazorPageActivator>(),
1329-
new HtmlTestEncoder(),
1330-
GetOptionsAccessor(expanders: null),
1331-
loggerFactory,
1332-
new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor"));
1333-
1334-
// Act
1335-
var result = viewEngine.CreateCacheResult(null, relativePath, false);
1336-
1337-
// Assert
1338-
var logMessage = Assert.Single(sink.Writes);
1339-
Assert.Equal($"Using precompiled view for '{relativePath}'.", logMessage.State.ToString());
1340-
}
1341-
13421306
[Theory]
13431307
[InlineData("/Test-View.cshtml")]
13441308
[InlineData("~/Test-View.CSHTML")]

test/Microsoft.AspNetCore.Mvc.RazorPages.Test/ApplicationModels/CompiledPageRouteModelProviderTest.cs

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
using Microsoft.AspNetCore.Mvc.RazorPages;
1010
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
1111
using Microsoft.AspNetCore.Razor.Hosting;
12-
using Microsoft.AspNetCore.Razor.Language;
1312
using Microsoft.Extensions.Logging;
1413
using Microsoft.Extensions.Logging.Abstractions;
1514
using Microsoft.Extensions.Options;
1615
using Xunit;
17-
using static Microsoft.AspNetCore.Razor.Hosting.TestRazorCompiledItem;
1816

1917
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
2018
{
@@ -125,34 +123,6 @@ public void OnProvidersExecuting_AddsModelsForCompiledViews_Version_2_1()
125123
});
126124
}
127125

128-
[Fact]
129-
public void OnProvidersExecuting_ValidatesChecksum_SkipsValidationWhenMainSourceMissing()
130-
{
131-
// Arrange
132-
var descriptors = new[]
133-
{
134-
CreateVersion_2_1_Descriptor("/Pages/About.cshtml", metadata: new object[]
135-
{
136-
new RazorSourceChecksumAttribute("SHA1", GetChecksum("some content"), "/Pages/About.cshtml"),
137-
new RazorSourceChecksumAttribute("SHA1", GetChecksum("some import"), "/Pages/_ViewImports.cshtml"),
138-
}),
139-
};
140-
141-
var fileSystem = new VirtualRazorProjectFileSystem();
142-
fileSystem.Add(new TestRazorProjectItem("/Pages/_ViewImports.cshtml", "some other import"));
143-
144-
var provider = CreateProvider(descriptors: descriptors, fileSystem: fileSystem);
145-
var context = new PageRouteModelProviderContext();
146-
147-
// Act
148-
provider.OnProvidersExecuting(context);
149-
150-
// Assert
151-
Assert.Collection(
152-
context.RouteModels,
153-
result => Assert.Equal("/Pages/About.cshtml", result.RelativePath));
154-
}
155-
156126
[Fact]
157127
public void OnProvidersExecuting_AddsModelsForCompiledAreaPages()
158128
{
@@ -472,19 +442,10 @@ public void OnProvidersExecuting_UsesTheFirstDescriptorForEachPath()
472442
var descriptors = new[]
473443
{
474444
// Page coming from the app
475-
CreateVersion_2_1_Descriptor("/Pages/About.cshtml", metadata: new object[]
476-
{
477-
new RazorSourceChecksumAttribute("SHA1", GetChecksum("some content"), "/Pages/About.cshtml"),
478-
}),
479-
CreateVersion_2_1_Descriptor("/Pages/Home.cshtml", metadata: new object[]
480-
{
481-
new RazorSourceChecksumAttribute("SHA1", GetChecksum("some content"), "/Pages/Index.cshtml"),
482-
}),
445+
CreateVersion_2_1_Descriptor("/Pages/About.cshtml"),
446+
CreateVersion_2_1_Descriptor("/Pages/Home.cshtml"),
483447
// Page coming from the app
484-
CreateVersion_2_1_Descriptor("/Pages/About.cshtml", metadata: new object[]
485-
{
486-
new RazorSourceChecksumAttribute("SHA1", GetChecksum("some content"), "/Pages/About.cshtml"),
487-
}),
448+
CreateVersion_2_1_Descriptor("/Pages/About.cshtml"),
488449
};
489450

490451
var provider = CreateProvider(descriptors: descriptors);
@@ -618,11 +579,9 @@ public void GetRouteTemplate_ReturnsNull_IfAttributeDoesNotExist()
618579

619580
private TestCompiledPageRouteModelProvider CreateProvider(
620581
RazorPagesOptions options = null,
621-
IList<CompiledViewDescriptor> descriptors = null,
622-
VirtualRazorProjectFileSystem fileSystem = null)
582+
IList<CompiledViewDescriptor> descriptors = null)
623583
{
624584
options = options ?? new RazorPagesOptions();
625-
fileSystem = fileSystem ?? new VirtualRazorProjectFileSystem();
626585

627586
var provider = new TestCompiledPageRouteModelProvider(
628587
new ApplicationPartManager(),
@@ -638,7 +597,6 @@ private static CompiledViewDescriptor CreateVersion_2_0_Descriptor(string path,
638597
{
639598
return new CompiledViewDescriptor
640599
{
641-
IsPrecompiled = true,
642600
RelativePath = path,
643601
ViewAttribute = new RazorPageAttribute(path, typeof(object), routeTemplate),
644602
};
@@ -650,7 +608,6 @@ private static CompiledViewDescriptor CreateVersion_2_1_Descriptor(
650608
{
651609
return new CompiledViewDescriptor
652610
{
653-
IsPrecompiled = true,
654611
RelativePath = path,
655612
Item = new TestRazorCompiledItem(typeof(object), "mvc.1.0.razor-page", path, metadata ?? Array.Empty<object>()),
656613
};

test/Microsoft.AspNetCore.Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="$(MicrosoftAspNetCoreRazorRuntimePackageVersion)" />
14-
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="$(MicrosoftAspNetCoreRazorLanguagePackageVersion)" />
1514
<PackageReference Include="Microsoft.Extensions.WebEncoders" Version="$(MicrosoftExtensionsWebEncodersPackageVersion)" />
1615
</ItemGroup>
1716

test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorProjectItem.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)