dotnet / dotnet/aspnetcore

@addTagHelper should give better user feedback for failures

Open
#11,780 12 comments 7 reactions 0 assignees View on GitHub
affected-medium area-mvc enhancement Priority:2 severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

I've lost a lot of time to tag helpers _after_ reading the docs. While they have been improved by clarifying the include is the assembly and not the namespace, there's still more that should be relayed to the user.

For example, I have a tag helper that works fine in 2.x, but breaks in 3.0. I have no idea why it's not registering, but it's not. My includes are:
```c#
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, MiniProfiler.AspNetCore.Mvc
```

Importantly, that looks like this:
![image](https://user-images.githubusercontent.com/454813/60476503-cdc07a80-9c49-11e9-8491-2e337b6e7394.png)

I have no idea if those names are valid names or what will happen at runtime. Can the tooling assist here? Note that I've added a complete garbage entry to illustrate the point. The app runs without issue with no warnings, complaints, or log entries...and those tag helpers just silently fail.

Compare this to any other experience in our world: if you have a using with a namespace that doesn't exist: boom. Type that's not there: boom. Argument: boom. Property: boom. We love booms! They save prod!

If I have a tag helper with an assembly it's unable to load, why isn't there an error?

The net result in my current case is I have a tag like this:
```html

```
And it renders as:
```html

```
...so, it silently fails. That should be a `` tag.

Can we please not be silent here? Can we make this go boom? Can we provide any information to the user at all about **why** their tag helpers aren't loading? If I explicitly tell Razor to load something and it can't, I'd like to know about it, because something is wrong. Or I should remove that call. The same as I would need to remove an `@using` if the namespace went away to successfully compile.

/cc @NTaylorMullen @rynowak

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.