From 0ccc3d647ece17efef96d5a33ed578eeb26f1fee Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 16 Dec 2020 22:29:07 -0800 Subject: [PATCH 1/3] Follow-up to cleaning up obsolete types in Razor --- .../src/FileProviderRazorProjectFileSystem.cs | 3 +- .../src/PageDirectiveFeature.cs | 2 +- .../VirtualRazorProjectFileSystem.cs | 3 +- .../src/InjectDirective.cs | 16 ----- .../src/ModelDirective.cs | 15 ----- .../src/RazorExtensions.cs | 61 ------------------- .../src/InjectDirective.cs | 16 ----- .../src/ModelDirective.cs | 15 ----- .../src/NamespaceDirective.cs | 14 ----- .../src/PageDirective.cs | 14 ----- .../src/InjectDirective.cs | 16 ----- .../src/ModelDirective.cs | 15 ----- .../src/PageDirective.cs | 14 ----- .../src/PublicAPI.Shipped.txt | 3 - .../src/DefaultRazorProjectFileSystem.cs | 3 +- .../src/EmptyProjectFileSystem.cs | 1 - .../src/Extensions/FunctionsDirective.cs | 14 ----- .../src/Extensions/InheritsDirective.cs | 14 ----- .../src/Extensions/SectionDirective.cs | 15 ----- .../src/PublicAPI.Shipped.txt | 3 - .../src/RazorProject.cs | 6 +- .../src/VirtualRazorProjectFileSystem.cs | 1 - .../test/TestRazorProject.cs | 1 - .../src/CompositeRazorProjectFileSystem.cs | 1 - .../Language/TestRazorProjectFileSystem.cs | 1 - 25 files changed, 7 insertions(+), 260 deletions(-) diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs index 0e4731b29f72..faeefa78d4b8 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs @@ -34,7 +34,6 @@ public FileProviderRazorProjectFileSystem(RuntimeCompilationFileProvider filePro public IFileProvider FileProvider => _fileProvider.FileProvider; - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -96,4 +95,4 @@ private static string JoinPath(string path1, string path2) return path1 + "/" + path2; } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs index 8113e1d6d4f5..2098ef927ceb 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs @@ -77,7 +77,7 @@ public override IEnumerable FindHierarchicalItems(string baseP return Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs index 01e778ca9876..db97c2c2340b 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs @@ -18,7 +18,6 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -44,4 +43,4 @@ public void Add(RazorProjectItem projectItem) _root.AddFile(new FileNode(filePath, projectItem)); } } -} \ No newline at end of file +} diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs index f5ea58312176..72d9db91603f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs @@ -104,21 +104,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - builder.AddTargetExtension(new InjectTargetExtension()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs index c16f46153ff6..cb15ba5c97ec 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs @@ -126,20 +126,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs index 6fe73b57aeb7..faff5f9e6fc4 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs @@ -56,66 +56,5 @@ public static void RegisterViewComponentTagHelpers(RazorProjectEngineBuilder bui builder.Features.Add(new ViewComponentTagHelperPass()); builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension()); } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - EnsureDesignTime(builder); - - InjectDirective.Register(builder); - ModelDirective.Register(builder); - - FunctionsDirective.Register(builder); - InheritsDirective.Register(builder); - - builder.Features.Add(new DefaultTagHelperDescriptorProvider()); - - // Register section directive with the 1.x compatible target extension. - builder.AddDirective(SectionDirective.Directive); - builder.Features.Add(new SectionDirectivePass()); - builder.AddTargetExtension(new LegacySectionTargetExtension()); - - builder.AddTargetExtension(new TemplateTargetExtension() - { - TemplateTypeName = "global::Microsoft.AspNetCore.Mvc.Razor.HelperResult", - }); - - builder.Features.Add(new ModelExpressionPass()); - builder.Features.Add(new MvcViewDocumentClassifierPass()); - } - - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void RegisterViewComponentTagHelpers(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - EnsureDesignTime(builder); - - builder.Features.Add(new ViewComponentTagHelperDescriptorProvider()); - builder.Features.Add(new ViewComponentTagHelperPass()); - builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension()); - } - -#pragma warning disable CS0618 // Type or member is obsolete - private static void EnsureDesignTime(IRazorEngineBuilder builder) -#pragma warning restore CS0618 // Type or member is obsolete - { - if (builder.DesignTime) - { - return; - } - - throw new NotSupportedException(Resources.RuntimeCodeGenerationNotSupported); - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs index 9442aaf64164..4e3e62ad9ad7 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs @@ -104,21 +104,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - builder.AddTargetExtension(new InjectTargetExtension()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs index cf80df5f686c..47b27a978a30 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs @@ -133,20 +133,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs index de05d354b1fb..fb04c0e3526e 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs @@ -186,19 +186,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) base.VisitDirective(node); } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs index 9b483f9b9f55..d9081a2057ae 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs @@ -103,19 +103,5 @@ public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs index 4282ea559f23..4f9e9f802234 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs @@ -111,21 +111,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - builder.AddTargetExtension(new InjectTargetExtension()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs index 4e0973f14a8c..70b508dd93b6 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs @@ -140,20 +140,5 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs index 322c6564ef4a..421861e0b88a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs @@ -103,19 +103,5 @@ public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode } } } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - return builder; - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt index 163cddf34207..e646c4737e1c 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt @@ -60,12 +60,9 @@ override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperPass.Or ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperIntermediateNode.FormatNode(Microsoft.AspNetCore.Razor.Language.Intermediate.IntermediateNodeFormatter formatter) -> void ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperIntermediateNode.WriteNode(Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeTarget target, Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext context) -> void ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperPass.ExecuteCore(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode documentNode) -> void -~static Microsoft.AspNetCore.Mvc.Razor.Extensions.InjectDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.InjectDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.GetModelType(Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode document) -> string -~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder -~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.TryGetPageDirective(Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode documentNode, out Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective pageDirective) -> bool ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.RazorExtensions.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs index de7f34f5cd71..fa9f8a2c5b45 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs @@ -16,7 +16,7 @@ public DefaultRazorProjectFileSystem(string root) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(root)); } - + Root = root.Replace('\\', '/').TrimEnd('/'); } @@ -61,7 +61,6 @@ public override RazorProjectItem GetItem(string path, string fileKind) return new DefaultRazorProjectItem("/", filePath, relativePhysicalPath, fileKind, new FileInfo(absolutePath), cssScope: null); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs index 50849709af97..9061245b5fed 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs @@ -15,7 +15,6 @@ public override IEnumerable EnumerateItems(string basePath) return Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs index 8947e20134d9..eb6ce5655e9e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs @@ -26,19 +26,5 @@ public static void Register(RazorProjectEngineBuilder builder) builder.AddDirective(Directive, FileKinds.Legacy, FileKinds.Component); builder.Features.Add(new FunctionsDirectivePass()); } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new FunctionsDirectivePass()); - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs index 74fa396bcc57..4f4b6910b101 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs @@ -28,19 +28,5 @@ public static void Register(RazorProjectEngineBuilder builder) builder.AddDirective(Directive, FileKinds.Legacy, FileKinds.Component, FileKinds.ComponentImport); builder.Features.Add(new InheritsDirectivePass()); } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new InheritsDirectivePass()); - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs index 9040e1868804..8e9b6095e8b2 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs @@ -28,20 +28,5 @@ public static void Register(RazorProjectEngineBuilder builder) builder.Features.Add(new SectionDirectivePass()); builder.AddTargetExtension(new SectionTargetExtension()); } - - #region Obsolete - [Obsolete("This method is obsolete and will be removed in a future version.")] - public static void Register(IRazorEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new SectionDirectivePass()); - builder.AddTargetExtension(new SectionTargetExtension()); - } - #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt index 585d72ed4f25..4290d14a8649 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt @@ -1382,12 +1382,9 @@ virtual Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorProviderContext.I ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind, bool optional) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind, bool optional, string name, string description) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor -~static Microsoft.AspNetCore.Razor.Language.Extensions.FunctionsDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.FunctionsDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void -~static Microsoft.AspNetCore.Razor.Language.Extensions.InheritsDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.InheritsDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.NamespaceDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder -~static Microsoft.AspNetCore.Razor.Language.Extensions.SectionDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.SectionDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.FileKinds.GetComponentFileKindFromFilePath(string filePath) -> string ~static Microsoft.AspNetCore.Razor.Language.FileKinds.GetFileKindFromFilePath(string filePath) -> string diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs index 164d59e142d1..159b06c8b85f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs @@ -28,7 +28,7 @@ public abstract class RazorProject /// /// The path. /// The . - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public abstract RazorProjectItem GetItem(string path); /// @@ -50,7 +50,7 @@ public abstract class RazorProject /// traverses to the project root. /// e.g. /// /Views/Home/View.cshtml -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml, /FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public IEnumerable FindHierarchicalItems(string path, string fileName) @@ -70,7 +70,7 @@ public IEnumerable FindHierarchicalItems(string path, string f /// traverses to the . /// e.g. /// (/Views, /Views/Home/View.cshtml) -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public virtual IEnumerable FindHierarchicalItems(string basePath, string path, string fileName) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs index c6bf87efb0db..376ea47e9abb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs @@ -19,7 +19,6 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs index 1c4faa7b5b81..a3d5d3d0f21d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs @@ -26,7 +26,6 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs index 092851d31108..93b0662620dc 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs @@ -27,7 +27,6 @@ public override IEnumerable EnumerateItems(string basePath) } } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs index ed8383a9f5b2..943becf2e93d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs @@ -28,7 +28,6 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); From 654f28e4eb945817561873ed2b365b48d7da63d7 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Fri, 18 Dec 2020 12:23:31 -0800 Subject: [PATCH 2/3] Revert "Follow-up to cleaning up obsolete types in Razor" This reverts commit 0ccc3d647ece17efef96d5a33ed578eeb26f1fee. --- .../src/FileProviderRazorProjectFileSystem.cs | 3 +- .../src/PageDirectiveFeature.cs | 2 +- .../VirtualRazorProjectFileSystem.cs | 3 +- .../src/InjectDirective.cs | 16 +++++ .../src/ModelDirective.cs | 15 +++++ .../src/RazorExtensions.cs | 61 +++++++++++++++++++ .../src/InjectDirective.cs | 16 +++++ .../src/ModelDirective.cs | 15 +++++ .../src/NamespaceDirective.cs | 14 +++++ .../src/PageDirective.cs | 14 +++++ .../src/InjectDirective.cs | 16 +++++ .../src/ModelDirective.cs | 15 +++++ .../src/PageDirective.cs | 14 +++++ .../src/PublicAPI.Shipped.txt | 3 + .../src/DefaultRazorProjectFileSystem.cs | 3 +- .../src/EmptyProjectFileSystem.cs | 1 + .../src/Extensions/FunctionsDirective.cs | 14 +++++ .../src/Extensions/InheritsDirective.cs | 14 +++++ .../src/Extensions/SectionDirective.cs | 15 +++++ .../src/PublicAPI.Shipped.txt | 3 + .../src/RazorProject.cs | 6 +- .../src/VirtualRazorProjectFileSystem.cs | 1 + .../test/TestRazorProject.cs | 1 + .../src/CompositeRazorProjectFileSystem.cs | 1 + .../Language/TestRazorProjectFileSystem.cs | 1 + 25 files changed, 260 insertions(+), 7 deletions(-) diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs index faeefa78d4b8..0e4731b29f72 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs @@ -34,6 +34,7 @@ public FileProviderRazorProjectFileSystem(RuntimeCompilationFileProvider filePro public IFileProvider FileProvider => _fileProvider.FileProvider; + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -95,4 +96,4 @@ private static string JoinPath(string path1, string path2) return path1 + "/" + path2; } } -} +} \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs index 2098ef927ceb..8113e1d6d4f5 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs @@ -77,7 +77,7 @@ public override IEnumerable FindHierarchicalItems(string baseP return Enumerable.Empty(); } - + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs index db97c2c2340b..01e778ca9876 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs @@ -18,6 +18,7 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -43,4 +44,4 @@ public void Add(RazorProjectItem projectItem) _root.AddFile(new FileNode(filePath, projectItem)); } } -} +} \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs index 72d9db91603f..f5ea58312176 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/InjectDirective.cs @@ -104,5 +104,21 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + builder.AddTargetExtension(new InjectTargetExtension()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs index cb15ba5c97ec..c16f46153ff6 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ModelDirective.cs @@ -126,5 +126,20 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs index faff5f9e6fc4..6fe73b57aeb7 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/RazorExtensions.cs @@ -56,5 +56,66 @@ public static void RegisterViewComponentTagHelpers(RazorProjectEngineBuilder bui builder.Features.Add(new ViewComponentTagHelperPass()); builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension()); } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + EnsureDesignTime(builder); + + InjectDirective.Register(builder); + ModelDirective.Register(builder); + + FunctionsDirective.Register(builder); + InheritsDirective.Register(builder); + + builder.Features.Add(new DefaultTagHelperDescriptorProvider()); + + // Register section directive with the 1.x compatible target extension. + builder.AddDirective(SectionDirective.Directive); + builder.Features.Add(new SectionDirectivePass()); + builder.AddTargetExtension(new LegacySectionTargetExtension()); + + builder.AddTargetExtension(new TemplateTargetExtension() + { + TemplateTypeName = "global::Microsoft.AspNetCore.Mvc.Razor.HelperResult", + }); + + builder.Features.Add(new ModelExpressionPass()); + builder.Features.Add(new MvcViewDocumentClassifierPass()); + } + + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void RegisterViewComponentTagHelpers(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + EnsureDesignTime(builder); + + builder.Features.Add(new ViewComponentTagHelperDescriptorProvider()); + builder.Features.Add(new ViewComponentTagHelperPass()); + builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension()); + } + +#pragma warning disable CS0618 // Type or member is obsolete + private static void EnsureDesignTime(IRazorEngineBuilder builder) +#pragma warning restore CS0618 // Type or member is obsolete + { + if (builder.DesignTime) + { + return; + } + + throw new NotSupportedException(Resources.RuntimeCodeGenerationNotSupported); + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs index 4e3e62ad9ad7..9442aaf64164 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/InjectDirective.cs @@ -104,5 +104,21 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + builder.AddTargetExtension(new InjectTargetExtension()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs index 47b27a978a30..cf80df5f686c 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ModelDirective.cs @@ -133,5 +133,20 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs index fb04c0e3526e..de05d354b1fb 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/NamespaceDirective.cs @@ -186,5 +186,19 @@ public override void VisitDirective(DirectiveIntermediateNode node) base.VisitDirective(node); } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs index d9081a2057ae..9b483f9b9f55 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/PageDirective.cs @@ -103,5 +103,19 @@ public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs index 4f9e9f802234..4282ea559f23 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/InjectDirective.cs @@ -111,5 +111,21 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + builder.AddTargetExtension(new InjectTargetExtension()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs index 70b508dd93b6..4e0973f14a8c 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ModelDirective.cs @@ -140,5 +140,20 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new Pass()); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs index 421861e0b88a..322c6564ef4a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PageDirective.cs @@ -103,5 +103,19 @@ public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode } } } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static IRazorEngineBuilder Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + return builder; + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt index e646c4737e1c..163cddf34207 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/PublicAPI.Shipped.txt @@ -60,9 +60,12 @@ override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperPass.Or ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperIntermediateNode.FormatNode(Microsoft.AspNetCore.Razor.Language.Intermediate.IntermediateNodeFormatter formatter) -> void ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperIntermediateNode.WriteNode(Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeTarget target, Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext context) -> void ~override Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperPass.ExecuteCore(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode documentNode) -> void +~static Microsoft.AspNetCore.Mvc.Razor.Extensions.InjectDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.InjectDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.GetModelType(Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode document) -> string +~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.ModelDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder +~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective.TryGetPageDirective(Microsoft.AspNetCore.Razor.Language.Intermediate.DocumentIntermediateNode documentNode, out Microsoft.AspNetCore.Mvc.Razor.Extensions.PageDirective pageDirective) -> bool ~static Microsoft.AspNetCore.Mvc.Razor.Extensions.RazorExtensions.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs index fa9f8a2c5b45..de7f34f5cd71 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs @@ -16,7 +16,7 @@ public DefaultRazorProjectFileSystem(string root) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(root)); } - + Root = root.Replace('\\', '/').TrimEnd('/'); } @@ -61,6 +61,7 @@ public override RazorProjectItem GetItem(string path, string fileKind) return new DefaultRazorProjectItem("/", filePath, relativePhysicalPath, fileKind, new FileInfo(absolutePath), cssScope: null); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs index 9061245b5fed..50849709af97 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs @@ -15,6 +15,7 @@ public override IEnumerable EnumerateItems(string basePath) return Enumerable.Empty(); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs index eb6ce5655e9e..8947e20134d9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/FunctionsDirective.cs @@ -26,5 +26,19 @@ public static void Register(RazorProjectEngineBuilder builder) builder.AddDirective(Directive, FileKinds.Legacy, FileKinds.Component); builder.Features.Add(new FunctionsDirectivePass()); } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new FunctionsDirectivePass()); + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs index 4f4b6910b101..74fa396bcc57 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/InheritsDirective.cs @@ -28,5 +28,19 @@ public static void Register(RazorProjectEngineBuilder builder) builder.AddDirective(Directive, FileKinds.Legacy, FileKinds.Component, FileKinds.ComponentImport); builder.Features.Add(new InheritsDirectivePass()); } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new InheritsDirectivePass()); + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs index 8e9b6095e8b2..9040e1868804 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Extensions/SectionDirective.cs @@ -28,5 +28,20 @@ public static void Register(RazorProjectEngineBuilder builder) builder.Features.Add(new SectionDirectivePass()); builder.AddTargetExtension(new SectionTargetExtension()); } + + #region Obsolete + [Obsolete("This method is obsolete and will be removed in a future version.")] + public static void Register(IRazorEngineBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.AddDirective(Directive); + builder.Features.Add(new SectionDirectivePass()); + builder.AddTargetExtension(new SectionTargetExtension()); + } + #endregion } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt index 4290d14a8649..585d72ed4f25 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Shipped.txt @@ -1382,9 +1382,12 @@ virtual Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorProviderContext.I ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind, bool optional) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor ~static Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor.CreateToken(Microsoft.AspNetCore.Razor.Language.DirectiveTokenKind kind, bool optional, string name, string description) -> Microsoft.AspNetCore.Razor.Language.DirectiveTokenDescriptor +~static Microsoft.AspNetCore.Razor.Language.Extensions.FunctionsDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.FunctionsDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void +~static Microsoft.AspNetCore.Razor.Language.Extensions.InheritsDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.InheritsDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.NamespaceDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder +~static Microsoft.AspNetCore.Razor.Language.Extensions.SectionDirective.Register(Microsoft.AspNetCore.Razor.Language.IRazorEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.Extensions.SectionDirective.Register(Microsoft.AspNetCore.Razor.Language.RazorProjectEngineBuilder builder) -> void ~static Microsoft.AspNetCore.Razor.Language.FileKinds.GetComponentFileKindFromFilePath(string filePath) -> string ~static Microsoft.AspNetCore.Razor.Language.FileKinds.GetFileKindFromFilePath(string filePath) -> string diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs index 159b06c8b85f..164d59e142d1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs @@ -28,7 +28,7 @@ public abstract class RazorProject /// /// The path. /// The . - + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public abstract RazorProjectItem GetItem(string path); /// @@ -50,7 +50,7 @@ public abstract class RazorProject /// traverses to the project root. /// e.g. /// /Views/Home/View.cshtml -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml, /FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public IEnumerable FindHierarchicalItems(string path, string fileName) @@ -70,7 +70,7 @@ public IEnumerable FindHierarchicalItems(string path, string f /// traverses to the . /// e.g. /// (/Views, /Views/Home/View.cshtml) -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public virtual IEnumerable FindHierarchicalItems(string basePath, string path, string fileName) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs index 376ea47e9abb..c6bf87efb0db 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs @@ -19,6 +19,7 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs index a3d5d3d0f21d..1c4faa7b5b81 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs @@ -26,6 +26,7 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs index 93b0662620dc..092851d31108 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs @@ -27,6 +27,7 @@ public override IEnumerable EnumerateItems(string basePath) } } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs index 943becf2e93d..ed8383a9f5b2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs @@ -28,6 +28,7 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } + [Obsolete("Use GetItem(string path, string fileKind) instead.")] public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); From e0a4e2d2934d615d5bae050b83e47cc03a595146 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Fri, 18 Dec 2020 12:37:08 -0800 Subject: [PATCH 3/3] Address feedback from peer review --- .../src/FileProviderRazorProjectFileSystem.cs | 4 ++-- .../src/PageDirectiveFeature.cs | 2 +- .../TestInfrastructure/VirtualRazorProjectFileSystem.cs | 4 ++-- .../src/DefaultRazorProjectFileSystem.cs | 4 ++-- .../src/EmptyProjectFileSystem.cs | 2 +- .../Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs | 6 +++--- .../src/VirtualRazorProjectFileSystem.cs | 2 +- .../test/TestRazorProject.cs | 2 +- .../src/CompositeRazorProjectFileSystem.cs | 2 +- .../Language/TestRazorProjectFileSystem.cs | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs index 0e4731b29f72..6a77ea1ac918 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectFileSystem.cs @@ -34,7 +34,7 @@ public FileProviderRazorProjectFileSystem(RuntimeCompilationFileProvider filePro public IFileProvider FileProvider => _fileProvider.FileProvider; - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -96,4 +96,4 @@ private static string JoinPath(string path1, string path2) return path1 + "/" + path2; } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs index 8113e1d6d4f5..2098ef927ceb 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageDirectiveFeature.cs @@ -77,7 +77,7 @@ public override IEnumerable FindHierarchicalItems(string baseP return Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs index 01e778ca9876..93b895980822 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/test/TestInfrastructure/VirtualRazorProjectFileSystem.cs @@ -18,7 +18,7 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); @@ -44,4 +44,4 @@ public void Add(RazorProjectItem projectItem) _root.AddFile(new FileNode(filePath, projectItem)); } } -} \ No newline at end of file +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs index de7f34f5cd71..a937894f903f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorProjectFileSystem.cs @@ -16,7 +16,7 @@ public DefaultRazorProjectFileSystem(string root) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(root)); } - + Root = root.Replace('\\', '/').TrimEnd('/'); } @@ -61,7 +61,7 @@ public override RazorProjectItem GetItem(string path, string fileKind) return new DefaultRazorProjectItem("/", filePath, relativePhysicalPath, fileKind, new FileInfo(absolutePath), cssScope: null); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs index 50849709af97..be7ab2d2feae 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/EmptyProjectFileSystem.cs @@ -15,7 +15,7 @@ public override IEnumerable EnumerateItems(string basePath) return Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs index 164d59e142d1..159b06c8b85f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorProject.cs @@ -28,7 +28,7 @@ public abstract class RazorProject /// /// The path. /// The . - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public abstract RazorProjectItem GetItem(string path); /// @@ -50,7 +50,7 @@ public abstract class RazorProject /// traverses to the project root. /// e.g. /// /Views/Home/View.cshtml -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml, /FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public IEnumerable FindHierarchicalItems(string path, string fileName) @@ -70,7 +70,7 @@ public IEnumerable FindHierarchicalItems(string path, string f /// traverses to the . /// e.g. /// (/Views, /Views/Home/View.cshtml) -> [ /Views/Home/FileName.cshtml, /Views/FileName.cshtml ] - /// + /// /// Project items returned by this method have inferred FileKinds from their corresponding file paths. /// public virtual IEnumerable FindHierarchicalItems(string basePath, string path, string fileName) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs index c6bf87efb0db..c46e0dc4fb7f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/VirtualRazorProjectFileSystem.cs @@ -19,7 +19,7 @@ public override IEnumerable EnumerateItems(string basePath) return directory?.EnumerateItems() ?? Enumerable.Empty(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs index 1c4faa7b5b81..1bb1e13ad303 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestRazorProject.cs @@ -26,7 +26,7 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs index 092851d31108..a3d4fc71654b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/CompositeRazorProjectFileSystem.cs @@ -27,7 +27,7 @@ public override IEnumerable EnumerateItems(string basePath) } } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs index ed8383a9f5b2..271c6224372d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestRazorProjectFileSystem.cs @@ -28,7 +28,7 @@ public override IEnumerable EnumerateItems(string basePath) throw new NotImplementedException(); } - [Obsolete("Use GetItem(string path, string fileKind) instead.")] + public override RazorProjectItem GetItem(string path) { return GetItem(path, fileKind: null);