Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. VS 2017 Unused variables in gray?

VS 2017 Unused variables in gray?

Scheduled Pinned Locked Moved Visual Studio
visual-studiotoolsquestionworkspace
8 Posts 3 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zequion
    wrote on last edited by
    #1

    1.- VS 2017 does not uses gray color for unused variables. Comes very well for debugging functions. I have looked at the internet and says that you have to adjust it in Tools, Options, Environment, Fonts and Colors, Display items, Dead Code item. It seems that this option does not exist in VS 2017 or in my VS 2017 translated into Spanish I do not find that option. The supposed output of "Display items" in spanish would be "Text Editor" but not exists nowhere "Dead Code item". Does anyone know what happened? 2.- Some way that when you open the solution, automatically open all .cs and leave everything as it was when closing?

    D 1 Reply Last reply
    0
    • Z zequion

      1.- VS 2017 does not uses gray color for unused variables. Comes very well for debugging functions. I have looked at the internet and says that you have to adjust it in Tools, Options, Environment, Fonts and Colors, Display items, Dead Code item. It seems that this option does not exist in VS 2017 or in my VS 2017 translated into Spanish I do not find that option. The supposed output of "Display items" in spanish would be "Text Editor" but not exists nowhere "Dead Code item". Does anyone know what happened? 2.- Some way that when you open the solution, automatically open all .cs and leave everything as it was when closing?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      1. Visual Studio already odes this by default. It'll put a white squiggly line under the variable and if you hove the mouse over it, it'll say "The variable 'x' is declared but never used." It'll also be in a gray box, at least it is in C# under the Dark Theme. 2. VS already does this by default. It'll open all the files that were open when the solution was saved and closed in the last session.

      A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      Z D 2 Replies Last reply
      0
      • D Dave Kreskowiak

        1. Visual Studio already odes this by default. It'll put a white squiggly line under the variable and if you hove the mouse over it, it'll say "The variable 'x' is declared but never used." It'll also be in a gray box, at least it is in C# under the Dark Theme. 2. VS already does this by default. It'll open all the files that were open when the solution was saved and closed in the last session.

        A guide to posting questions on CodeProject

        Click this: Asking questions is a skill. Seriously, do it.
        Dave Kreskowiak

        Z Offline
        Z Offline
        zequion
        wrote on last edited by
        #3

        1.- The unused variables appear to me in black like the rest of the text. In VS 2015 they were gray. 2.- When I open the solution, it does not show it as it was when closing. All black appears and the Solution Explorer box on the right. How do you configure both?

        D 1 Reply Last reply
        0
        • Z zequion

          1.- The unused variables appear to me in black like the rest of the text. In VS 2015 they were gray. 2.- When I open the solution, it does not show it as it was when closing. All black appears and the Solution Explorer box on the right. How do you configure both?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          1. On the Light theme, it's a green squiggly and no box. There is no way to configure the color of the text. You can configure the color of the squiggly line, that's all. Tools -> Options -> Environment -> Fonts and Colors. In the long "Display items" list, find "Warning". There is no "Dead Code" item in this list unless you install CodeRush. 2. I don't know what you did to it to get it to mess up, but the default, out-of-the-box, behavior, is to open all files that were open the last time the solution was closed. There is no configuration option for this. Do you have your settings saved to a network location by chance? Tools -> Options -> Environment -> Import and Export Settings.

          A guide to posting questions on CodeProject

          Click this: Asking questions is a skill. Seriously, do it.
          Dave Kreskowiak

          Z 2 Replies Last reply
          0
          • D Dave Kreskowiak

            1. On the Light theme, it's a green squiggly and no box. There is no way to configure the color of the text. You can configure the color of the squiggly line, that's all. Tools -> Options -> Environment -> Fonts and Colors. In the long "Display items" list, find "Warning". There is no "Dead Code" item in this list unless you install CodeRush. 2. I don't know what you did to it to get it to mess up, but the default, out-of-the-box, behavior, is to open all files that were open the last time the solution was closed. There is no configuration option for this. Do you have your settings saved to a network location by chance? Tools -> Options -> Environment -> Import and Export Settings.

            A guide to posting questions on CodeProject

            Click this: Asking questions is a skill. Seriously, do it.
            Dave Kreskowiak

            Z Offline
            Z Offline
            zequion
            wrote on last edited by
            #5

            I installed Vs2017 the other day and I have not changed the colors. In VS 2015 appeared gray. I deleted the import/export configuration. I have changed to the three themes: blue, clear, dark. At all times if for example I put: bool fcn o bool fcn = true; and I do not use it, the text appears the same color as the rest, in black for the "blue" theme. In Spanish, "display items" does not appear but appears "Text editor" and in "Warning" foreground appears green and in "Code analysis warning" foreground appears in yellow. Appears "Code excluded" in gray and "obsolete code" in mauve. For the rest, if I have several .cs open and close, never open it has shown me everything I was, neither in 2017 or in 2015.

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              1. On the Light theme, it's a green squiggly and no box. There is no way to configure the color of the text. You can configure the color of the squiggly line, that's all. Tools -> Options -> Environment -> Fonts and Colors. In the long "Display items" list, find "Warning". There is no "Dead Code" item in this list unless you install CodeRush. 2. I don't know what you did to it to get it to mess up, but the default, out-of-the-box, behavior, is to open all files that were open the last time the solution was closed. There is no configuration option for this. Do you have your settings saved to a network location by chance? Tools -> Options -> Environment -> Import and Export Settings.

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              Z Offline
              Z Offline
              zequion
              wrote on last edited by
              #6

              Last minute: 1.- In "Project", "Properties", "Compilation", "Delete warnings", among others was included CS0168 so that it does not show error messages by unused variables. The option "Treat warnings as Errors" in: none. In VS 2015 everything was well showing up these variables in gray. In VS2017 I have removed this warning and the unused variables appears in black with a wavy green line. I have checked that it uses "Display items" (Text Editor in spanish) and "Warning" but it does not allow to put the text foreground in gray, only to change the green wavy line. It serves me well, but something has changed and I wanted it gray as it was, not black. 2.- I still do not know how to do to open the solution replenish the pages that were open last time. And besides, when compiling the first time because I use admin credentials in app.manifest, it forces me to exit and re-open VS again and I have to open all the pages again. I waste a lot of time every day on that. thanks for your help

              D 1 Reply Last reply
              0
              • Z zequion

                Last minute: 1.- In "Project", "Properties", "Compilation", "Delete warnings", among others was included CS0168 so that it does not show error messages by unused variables. The option "Treat warnings as Errors" in: none. In VS 2015 everything was well showing up these variables in gray. In VS2017 I have removed this warning and the unused variables appears in black with a wavy green line. I have checked that it uses "Display items" (Text Editor in spanish) and "Warning" but it does not allow to put the text foreground in gray, only to change the green wavy line. It serves me well, but something has changed and I wanted it gray as it was, not black. 2.- I still do not know how to do to open the solution replenish the pages that were open last time. And besides, when compiling the first time because I use admin credentials in app.manifest, it forces me to exit and re-open VS again and I have to open all the pages again. I waste a lot of time every day on that. thanks for your help

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                1. Don't know. Might want to post this on Microsoft's Connect site to ask them to implement it. 2. If your app requires Admin privileges, launch VS as an administrator and your code will execute as an admin under the debugger.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                1 Reply Last reply
                0
                • D Dave Kreskowiak

                  1. Visual Studio already odes this by default. It'll put a white squiggly line under the variable and if you hove the mouse over it, it'll say "The variable 'x' is declared but never used." It'll also be in a gray box, at least it is in C# under the Dark Theme. 2. VS already does this by default. It'll open all the files that were open when the solution was saved and closed in the last session.

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  D Offline
                  D Offline
                  David A Gray
                  wrote on last edited by
                  #8

                  Not only that, but so are unused namespaces in your Using directives. Not only that, but when you add a directive, it will similarly flag the fully qualified names that can be shortened, and offer to fix them for you. That bit started in VS 2015.

                  David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups