I just created new blazor project via
dotnet new blazorhosted
and opened FetchData.cshtml, but VS threw 9 errors at me.
Of course whole project is compiling & works fine, but it's very annoying
How can I disable showing errors for .cshtml files?
Visual Studio 2019 Preview
Severity    Code    Description Project File    Line    Suppression State
Error   CS0103  The name 'forecasts' does not exist in the current context  Blazor.Client   FetchData.cshtml    27  Active
Error   CS0115  'Template.ExecuteAsync()': no suitable method found to override Blazor.Client   FetchData.cshtml    1   Active
Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active
Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active
Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active
Error   CS0103  The name 'page' does not exist in the current context   Blazor.Client   FetchData.cshtml    4   Active
Error   CS0103  The name 'inject' does not exist in the current context Blazor.Client   FetchData.cshtml    5   Active
Error   CS0103  The name 'forecasts' does not exist in the current context  Blazor.Client   FetchData.cshtml    11  Active
Error   CS0103  The name 'functions' does not exist in the current context  Blazor.Client   FetchData.cshtml    37  Active
Sometimes Blazor blows up on me and throws errors on lines that have no errors, just like this.
I close the file(s), clean the entire solution, restart my computer, then rebuild just the project I am working on and it goes away.
Maybe that will work for you too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With