VS2022 Syntax errors
See original GitHub issueStyleCop doesn’t seem to like using declarations in VS2022. It works fine in VS2019.
Repro:
- Create a new C# project in VS2022.
- Install the latest pre-release StyleCop (1.2.0-beta.406)
- Inside a method, add the following line:
using var cts = new CancellationTokenSource();
- Notice that you now have an error: “A syntax error has been discovered in file Program.cs on line 5. [StyleCop Rule: SA0102]”
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Visual Studio 2022 not showing syntax errors and ...
Go to Tools menu, and select Options. Under Intellicode select General. Just uncheck “C# Suggestions”. Then restart Visual Studio and check that ...
Read more >Fix program errors and improve code - Visual Studio ...
Errors are sometimes obvious, such as a simple syntax error or incorrect variable name, and sometimes they're difficult to understand, with only ...
Read more >syntax highlighting on Visual Studio 2022 not working ...
First try fixing the error in your get component call, sometimes the highlighting doesn't work if it isn't written correctly. Otherwise, make ...
Read more >VS designer generated code changed with errors
All of a sudden i get 99 syntax errors of the same type in windows form designer file instead of CType(Me.SplitLeft.Panel2, Global.System.
Read more >Fixing Visual Studio Intellisense Errors - Rick Strahl's Web Log
Just updated VS2022 and had this problem. Code compiled fine but lots of intellisense issues. Deleting the .vs folder cleared it up. Saved...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I apologize for all this. I wasn’t able to track it down with the binlog, but I had forgotten that ReSharper had a StyleCop extension enabled. Once I disabled that, the problem went away. I will close this issue. I really appreciate the help.
Glad to hear the binlog helped!