I have a Blazor web project, and am getting errors on one rather large page file when I build. There are no errors if I close and relaunch VS 2022, until I build. Then, it says there are 2 errors ("} expected" and "; expected"), but it shows them in the .g file, and when I double-click on the error line in the Error window, nothing happens.
How do I trace to where in the source code the bad lines are? There are 1300 lines of code in this page...
CodePudding user response:
I had to close and relaunch Visual Studio a couple of times, now it shows the error on the correct .razor page file. Apparently CodeLens and syntax checking are very flakey in Razor pages. Once these 2 errors were resolved, went away, and there were no more errors - I did a Build, and it came up with another "; expected". Which of course was resolved by closing and relaunching VS, reopening the solution, and waiting for CodeLens to check the opened file. Then the error came up.
CodePudding user response:
In blazor (VS2022 current version) don't look at the errors tab, always check the "Output" tab, you'll find the errors there, and double clicking on them usually will get you to the correct line.
the .g
files are generated code:
error the in razor.g.cs file, can't find in VS, can't find the _razor.g.cs file