You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove IncrementCount from @onclick handler, resulting in @onclick=""
Expected behavior:
I see an single-charachter error on "" similar as how C# would do in such cases:
Actual behavior:
Error location takes seemingly random half of the file:
There are actually 2 errors: CS1525: Invalid expression term ')' and a razor-specific error RZ2008: Attribute '@onclick' on tag helper element 'button' requires a value. Tag helper bound attributes of type 'Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.Web.MouseEventArgs>' cannot be empty or contain only whitespace. The first one shouldn't be there at all since it is an implementation detail of how razor works. The second one, although, very accurate, seems to be an overkill to me. Having just something like a C# error CS1733: Expression expected would be way easier to read and parse in my head, while would still be pretty accurate - after all, an expression returning a delegate of several allowed shapes is expected to be there.
Additional info:
This happens quite a lot in the middle of an edit to a file. And it is pretty annoying to see half of the file become one giant error several times in a row as you type.
The text was updated successfully, but these errors were encountered:
Personally speaking I've been of the opinion that if the compiler can produce an RZ diagnostic, it shouldn't produce C# code that will also have its own diagnostics. That does affect tooling scenarios though (eg, if there is no C# generated than how do we provide completion when the user invokes it in the attribute value?) so it might not always be possible.
I've labelled this as compiler, but it might be that tooling can make some changes here too, like not reporting the CS diagnostics if they overlap an RZ? Maybe needs a bit of a design process encompassing both teams.
VS version:
17.10 Preview 7
Steps to reproduce:
Counter.razor
IncrementCount
from@onclick
handler, resulting in@onclick=""
Expected behavior:
I see an single-charachter error on
""
similar as how C# would do in such cases:Actual behavior:
CS1525: Invalid expression term ')'
and a razor-specific errorRZ2008: Attribute '@onclick' on tag helper element 'button' requires a value. Tag helper bound attributes of type 'Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.Web.MouseEventArgs>' cannot be empty or contain only whitespace
. The first one shouldn't be there at all since it is an implementation detail of how razor works. The second one, although, very accurate, seems to be an overkill to me. Having just something like a C# error CS1733: Expression expected would be way easier to read and parse in my head, while would still be pretty accurate - after all, an expression returning a delegate of several allowed shapes is expected to be there.Additional info:
This happens quite a lot in the middle of an edit to a file. And it is pretty annoying to see half of the file become one giant error several times in a row as you type.
The text was updated successfully, but these errors were encountered: