Make ~/ resolution show up at design time.

- This change results in proper errors for tags that utilize `~/`inside of local functions at design time.
- Updated TagHelper in code blocks analyzer error to mention `~/` since it will typically be a cause of confusion.

#10734
This commit is contained in:
N. Taylor Mullen 2019-06-24 14:39:47 -07:00
parent c56fb8046c
commit 4623ce7f94
3 changed files with 1 additions and 3 deletions

View File

@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
new DiagnosticDescriptor(
"MVC1006",
"Methods containing TagHelpers must be async and return Task.",
"The method contains a TagHelper and therefore must be async and return a Task.",
"The method contains a TagHelper and therefore must be async and return a Task. For instance, usage of ~/ typically results in a TagHelper and requires an async Task returning parent method.",
"Usage",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

View File

@ -356,7 +356,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.TagHelpers
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("track", Attributes="[src^='~/']", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("video", Attributes="[poster^='~/']")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("video", Attributes="[src^='~/']")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public partial class UrlResolutionTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public UrlResolutionTagHelper(Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, System.Text.Encodings.Web.HtmlEncoder htmlEncoder) { }

View File

@ -50,7 +50,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.TagHelpers
[HtmlTargetElement("track", Attributes = "[src^='~/']", TagStructure = TagStructure.WithoutEndTag)]
[HtmlTargetElement("video", Attributes = "[src^='~/']")]
[HtmlTargetElement("video", Attributes = "[poster^='~/']")]
[EditorBrowsable(EditorBrowsableState.Never)]
public class UrlResolutionTagHelper : TagHelper
{
// Valid whitespace characters defined by the HTML5 spec.