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

Commit

Permalink
Workaround tooling issue with runtime only TagHelpers.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
NTaylorMullen committed Mar 29, 2017
1 parent fdea426 commit dd9eab5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 63 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/Microsoft.AspNetCore.Razor.Evolution/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ internal string ProcessTagHelperPrefix(List<TagHelperDirectiveDescriptor> direct

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;
}

Expand All @@ -170,12 +165,7 @@ internal string ProcessTagHelperPrefix(List<TagHelperDirectiveDescriptor> direct

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,40 +256,6 @@ public void Execute_SetsTagHelperDocumentContext()
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()
{
Expand Down

0 comments on commit dd9eab5

Please sign in to comment.