I suggest you ...

Automatically fix fixable errors

Some errors in the error list could be automatically fixed. For instance, you build your code and the error "The type 'bla' is not referenced. You must add a reference to assembly 'System.Data.Entity'" appears in the error pane. This error is easily fixed by adding the correct reference to the project, but since Studio already knows what it's looking for, it knows where it's located (GAC), why isn't there an option to fix it?

It would be nice if the error pane would have a column "Autoresolve" with for each error which migh be fixable a link "Try resolving". Studio would then try to autoresolve the problem, for instance by adding the correct reference to the project and all would be well. If there was a problem resolving the problem, Studio could display an error message telling the user the autofix didn't work and he should correct the problem himself.

In the same category, auto fixes could be applied for things like missing/extra parentheses, ; characters, etc. etc. I think the list of autoresolvable things is actually pretty long.

But please note: VS should NEVER do this on it's own. It should always be the developers action to perform an autoresolve.

106 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…)
    Jasper SiegmundJasper Siegmund shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    6 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...
      • Martijn HoekstraMartijn Hoekstra commented  ·   ·  Flag as inappropriate

        VS already has some autofix (press ctrl-. on the line with the error and autofixes show up) but I do like the addition of being able to do this in the problems window (with some sensible behaviour: focus the window on the line in question, show a dialog with options), and I very very much would like adding a reference to a project in the current solution to be autofixible.

      • Benjamin HowarthBenjamin Howarth commented  ·   ·  Flag as inappropriate

        Also add missing using; statements. I'm walking through 200 build errors simply adding one line to each and every single file, and the IDE knows where to find the class already.

      • PhilippePhilippe commented  ·   ·  Flag as inappropriate

        Add missing included in C++ code. In that case, it could be added at the end by default and the line be automatically selected so that we can move it elsewhere easily if desired.

      • Madushan SiriwardenaMadushan Siriwardena commented  ·   ·  Flag as inappropriate

        remove unused using statements when building.. (They're pretty easy to add ... just CTRL+. but normally forget to remove and gets the top of the file cluttered.)

        Also, 'fix ';' expected' compile error automatically..

      • ChrisSChrisS commented  ·   ·  Flag as inappropriate

        Also remove unused references automatically (or add that option in the tools) upon pre-release builds.

      Feedback and Knowledge Base