question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS2022 Syntax errors

See original GitHub issue

StyleCop doesn’t seem to like using declarations in VS2022. It works fine in VS2019.

Repro:

  1. Create a new C# project in VS2022.
  2. Install the latest pre-release StyleCop (1.2.0-beta.406)
  3. Inside a method, add the following line: using var cts = new CancellationTokenSource();
  4. 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:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nstodcommented, Feb 10, 2022

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.

0reactions
sharwellcommented, Feb 10, 2022

Glad to hear the binlog helped!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found