"The attribute names could not be inferred from bind attribute 'bind-value'" exception in Blazor

It turns out there are at least two causes of this:

The component name is now case-sensitive

The answer turns out to be that naming of blazor components is now case-sensitive, and I was missing a capital letter in 'TelerikDropdownList' which should be TelerikDropDownList.

The change to use case-sensitive names is documented here and is also discussed here and in the official documentation here. The idea was to reduce misleading messages, but it's had the consequence of introducing another one, so I've raised an issue for that on the AspNetCore repo.

You've forgotten the @using statement for the component's namespace

You'll also get the same error if you've forgotten or removed the @using statement for the component's namespace. That's very easy to do if you're using ReSharper as it is currently flagging them as unused and offering to remove them.

Checking if this is the issue

A good way to check if the compiler has correctly identified your component as a Blazor component rather than a HTML tag is to check the colour coding of the keywords. They will be the same colour if things are working correctly (green in the example below):

enter image description here

Whereas if the name or namespace are wrong you'll see a mix of colours (note that Data and ValueField are now a different colour to TelerikDropdownList):

enter image description here


“The attribute names could not be inferred from bind attribute 'bind-value'” exception in Blazor

I had a similar issue, but the solution was rather ridicolous than ridicolously easy!

Finally I found the information that adding a missing using statement of the used component was helpful. so did I. And it worked!

Despite my component name was shown in green color (like the component type was recognized) it wasn't. Only the missing using did this correctly. Such a missleading behavior.

So if you have the same problem, First check if you're missing an 'using' for the actual component even it is shown in green color.

Tags:

C#

Blazor