Workaround tooling issue with runtime only TagHelpers.
- Prior to this if all instances of `TagHelper`s in an assembly had editor browsable never we'd log an error saying that no TagHelpers were found for that assembly. Until we can evaluate a better fix for this issue I've removed the logic that logs those errors and its corresponding tests/resources. #1145
This commit is contained in:
parent
fdea42624d
commit
dd9eab551d
|
|
@ -136,20 +136,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
internal static string FormatTagHelperAssemblyNameCannotBeEmptyOrNull()
|
||||
=> GetString("TagHelperAssemblyNameCannotBeEmptyOrNull");
|
||||
|
||||
/// <summary>
|
||||
/// The assembly '{0}' could not be resolved or contains no tag helpers.
|
||||
/// </summary>
|
||||
internal static string TagHelperAssemblyCouldNotBeResolved
|
||||
{
|
||||
get => GetString("TagHelperAssemblyCouldNotBeResolved");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The assembly '{0}' could not be resolved or contains no tag helpers.
|
||||
/// </summary>
|
||||
internal static string FormatTagHelperAssemblyCouldNotBeResolved(object p0)
|
||||
=> string.Format(CultureInfo.CurrentCulture, GetString("TagHelperAssemblyCouldNotBeResolved"), p0);
|
||||
|
||||
/// <summary>
|
||||
/// Path must begin with a forward slash '/'.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -144,9 +144,6 @@
|
|||
<data name="TagHelperAssemblyNameCannotBeEmptyOrNull" xml:space="preserve">
|
||||
<value>Tag helper directive assembly name cannot be null or empty.</value>
|
||||
</data>
|
||||
<data name="TagHelperAssemblyCouldNotBeResolved" xml:space="preserve">
|
||||
<value>The assembly '{0}' could not be resolved or contains no tag helpers.</value>
|
||||
</data>
|
||||
<data name="RazorProject_PathMustStartWithForwardSlash" xml:space="preserve">
|
||||
<value>Path must begin with a forward slash '/'.</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -138,12 +138,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
if (!AssemblyContainsTagHelpers(parsed.AssemblyName, tagHelpers))
|
||||
{
|
||||
errorSink.OnError(
|
||||
parsed.AssemblyNameLocation,
|
||||
Resources.FormatTagHelperAssemblyCouldNotBeResolved(parsed.AssemblyName),
|
||||
parsed.AssemblyName.Length);
|
||||
|
||||
// Skip this one, it's an error
|
||||
// No tag helpers in the assembly.
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -170,12 +165,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
if (!AssemblyContainsTagHelpers(parsed.AssemblyName, tagHelpers))
|
||||
{
|
||||
errorSink.OnError(
|
||||
parsed.AssemblyNameLocation,
|
||||
Resources.FormatTagHelperAssemblyCouldNotBeResolved(parsed.AssemblyName),
|
||||
parsed.AssemblyName.Length);
|
||||
|
||||
// Skip this one, it's an error
|
||||
// No tag helpers in the assembly.
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,40 +256,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
Assert.Empty(context.TagHelpers);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Execute_AddsErrorWhenNoTagHelpersAreFoundInAssembly()
|
||||
{
|
||||
// Arrange
|
||||
var engine = RazorEngine.Create(builder =>
|
||||
{
|
||||
builder.Features.Add(new TestTagHelperFeature());
|
||||
});
|
||||
|
||||
var pass = new TagHelperBinderSyntaxTreePass()
|
||||
{
|
||||
Engine = engine,
|
||||
};
|
||||
|
||||
var sourceDocument = CreateTestSourceDocument();
|
||||
var codeDocument = RazorCodeDocument.Create(sourceDocument);
|
||||
var originalTree = RazorSyntaxTree.Parse(sourceDocument);
|
||||
|
||||
var expectedError = RazorDiagnostic.Create(
|
||||
new RazorError(
|
||||
Resources.FormatTagHelperAssemblyCouldNotBeResolved("TestAssembly"),
|
||||
new SourceLocation(Environment.NewLine.Length + 17, 1, 1),
|
||||
length: 12));
|
||||
|
||||
// Act
|
||||
var outputTree = pass.Execute(codeDocument, originalTree);
|
||||
|
||||
// Assert
|
||||
Assert.Same(originalTree.Root, outputTree.Root);
|
||||
|
||||
var error = Assert.Single(outputTree.Diagnostics);
|
||||
Assert.Equal(expectedError, error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Execute_RecreatesSyntaxTreeOnResolverErrors()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue