Error recovery when an expression is not provided is very poor
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
**VS version:**
17.10 Preview 7
**Steps to reproduce:**
1. Create a sample blazor web app
2. Go to `Counter.razor`
3. 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:**
1. Error location takes seemingly random half of the file:

2. 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' 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](https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs1733) 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.
Contributor guide
Assessment
This issue has not been assessed yet.