I suggest you ...

Find dead/unused code in the solution

After some time certain parts of code i n a project end up not being used anymore and just waste screen estate. It would be handy if Visual Studio could detect this and warn you about it.

617 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    XIIIXIII shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    15 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Henry WyckoffHenry Wyckoff commented  ·   ·  Flag as inappropriate

        Interesting idea. I guess part of the challenge would be identifying whether something really is dead or unused. What if something is momentarily unused but you (or other team members) need to use that code later? if it gets removed because it's unused, then you'd have to go through the trouble of putting it back.

      • Yisroel OlewskiYisroel Olewski commented  ·   ·  Flag as inappropriate

        absolutely, finding dead code is very important. and im referring to .net (vb/c#) code. the current code analysis does a pretty poor job of finding dead code.

      • ScottScott commented  ·   ·  Flag as inappropriate

        Mads,

        Given most development is of existing software systems, consider a good chunk of the next VS version development effort to be well invested in finding dead, unused code, parameters, variables, types, css elements, javascript methods,...

        Creating a new solution or adding scaffolding for new objects in a solution is great, but it does not address the large amount of existing code.

        Static analysis is an effective method of delivering higher quality systems in less time at lower cost.

        This is the whole argument for using TypeScript over plain JavaScript.

      • CodePal DaveCodePal Dave commented  ·   ·  Flag as inappropriate

        Would like it if VS automatically showed a warning about methods where the reference count was zero.

      • DaverDaver commented  ·   ·  Flag as inappropriate

        It might be nice to be able to provide options to bulk comment and/or remove dead CSS and Javascript code. Another option would be to visually color or identify dead code... like red background for the code.

      • DaverDaver commented  ·   ·  Flag as inappropriate

        Great idea to remove the bloat from unused CSS and Javascript to reduce payload size. Other options could be to bulk comment out unused code, move code to end of file.

      • Miles Miles commented  ·   ·  Flag as inappropriate

        I believe visual studio already alerts of unreachable code in c#

      • bhaelochonbhaelochon commented  ·   ·  Flag as inappropriate

        As an overall suggestion, this probably belongs on the Visual Studio UserVoice forum. But specifically finding dead/unused JS/CSS would be helpful, too.

      Feedback and Knowledge Base