skip to Main Content

New install of Visual Studio 2022 – NET 6 project.

In the past, the variables (in the 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.

After installing VS 2022 I cannot figure out how to make these types of suggestions appear. Can anyone help me with this?

enter image description here

Edit – Additional info

I think, maybe it’s rule IDE1006 that I am trying to activate in the IDE

Also, in (Tools)(Options) I have these settings. But not a single notification about variable names that violate IDE1006

enter image description here

I can see all of these notifications too (pic below), so, I know with certainty the code is being analyzed (the analysis is just not pointing out (variable name) violations)

enter image description here

3

Answers


  1. Chosen as BEST ANSWER

    I edited my .editorconfig file (added the lines below), and now the Style Rules, specifically (IDE1006 naming rule violation), etc are enabled/flagged in my source code

    dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
    dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
    dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
    dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
    dotnet_naming_style.camel_case_style.capitalization = camel_case
    

    enter image description here


  2. In addition to catching flat out syntax errors, Visual Studio does have code analyzers.

    This feature still works. Looking at your image, it appears there are those dotted lines under offet_A and offetBecause. It’s hard to know exactly why because I don’t have enough context of the few lines we’re looking at.

    I do know that method names starting with lower-case letter generally trigger this warning, but again, we can’t see if you have that going on either.

    So my answer is this feature is still active. But it only happens for naming that violates accepted naming conventions.

    Login or Signup to reply.
  3. There is a setting for enabling and disabling specific style guidance selections.

    enter image description here

    You will need to navigate to Tools/Options/Text Editor/C#/Code Style/General

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search