not warning about code styles or variable naming?

CharliePrince

New member
Joined
Feb 28, 2022
Messages
1
Programming Experience
1-3
New install of Visual Studio 2022 - NET 6 project.

In the past, the 'blue cheese' variables (in pic below) would have little squiggles underneath them and when I hover the mouse over them a suggestion would pop up stating something similar to (names are not cased or capitalized correctly). It was like the IDE had a code analyzer (maybe an extension/addon) that constantly monitored coding styles.

I installed VS 2022 and cannot figure out how to make these types of suggestions appear C# 2022. Can anyone help me with this?


1661722932174.png
 
Whenever you install a new application, one of the first things you should do is take a thorough look through the options/settings/preferences to see what's available and what might need changing. VS is no exception. Have you done that? I don't know off the top of my head where this would be determined - I use ReSharper and so these sorts of things can be different anyway - but it is almost certainly going to be somewhere in that Options dialogue.

Note that, if you are seeing different behaviour in comparison to an old version of VS, you can compare the options in each to see where the differences are. You can also import and export options in VS, but I'm not sure whether it can be done across versions. I rarely use that functionality because I do as I suggested above.
 
I don't guarantee that you'll get VS to complain that you have called it bluecheese1 rather than blueCheese1 as VS doesn't really care about "blue" being distinct from "cheese" but you can get it to e.g. complain that you haven't prefixed a private member with underscore or that a public member isn't PascalCase

You'll need to go Tools/Options/Editor/C#/Code Style/Naming. You may have to add a style that reflects your wish, and also add a set of members that it applies to - for example you can even insist that async methods are suffixed with Async (but there is an extension for that too that is a bit more comprehensive)

Also worth installing Roslynator
 
I have a feeling that the OP maybe conflating StyleCop with Intellisense.
 
I don't guarantee that you'll get VS to complain that you have called it bluecheese1 rather than blueCheese1 as VS doesn't really care about "blue" being distinct from "cheese"
Rather nicely, ReSharper also includes a spell-checker and it will flag a spelling error if the "c" in "bluecheese1" is not made upper-case.
 
Back
Top Bottom