Auto-fix

Enterprise Edition only

Problem auto-fix repairs programming problems automatically. It generates a copy of the analyzed project and modifies the the code, line by line, according to the problem found. This way you can automatically remove dead code, apply some optimizations and fix style issues. Problems are either fixed automatically or added as comments in the source code for easy manual fixing. Optionally, you can insert problem descriptions into the Task List of Visual Studio .NET. Auto-fix saves you from the repetitive task of manually locating and correcting simple problems in the code.

Auto-fix options
Auto-fix problem list

Manual fix

There are a lot of problem types that cannot be fixed automatically. These problems require a human developer to review and repair.

The auto-fix feature helps in this process by adding comments in the code. After auto-fix, you use these comments to locate problem areas and make the required changes.

In many cases, Project Analyzer auto-fix recommends possible fixes. To give examples, this is the case with the NameCheck and Excess Scope problems. For NameCheck problems, Project Analyzer suggests names that conform to the selected naming standard. For Excess Scope problems, Project Analyzer gives instructions on how to change a declaration and where to move it.

Auto-fixable problems may optionally be handled as manual fixes. This is useful in critical program areas where human review is required for any changes.

Auto-fix and the Visual Studio .NET Task List

If you use Visual Studio .NET, you can use auto-fix to insert problems into the Task List for easy treatment. Read more in Auto-fix options.

Visual Studio .NET Task List
Auto-fix integrated with the Visual Studio Task List

Recommendations

A large project may contain thousands of problems. It is probably wise to handle just a limited number of problem types at once. Define a problem filter with some of the most important problems, and try with those ones first. This is especially true if your project has a lot of problems requiring manual fixes. Also, if a bug should arise in the fix process, it's much easier to detect when the number of changes is reasonable.

You can use auto-fix to quickly optimize your application before releasing it. Select a problem filter with only optimization related problems — such as dead code and performance related issues. In the Auto-fix options, select Fix quietly for Auto-fix and Ignore for Manual fix. Now you get an automatically cleaned new project ready for compilation. You may continue programming with your original code, while the users use the polished one. Don't forget to test your program before release!

ASP.NET projects. After auto-fixing an ASP.NET project, we recommend that you make a backup of the original code and copy the auto-fixed code over the existing code. This way you can utilize your existing web settings. You may use your old .sln and .suo files rather than the files in the new directory.

Limitations

For VB.NET files, Auto-fix can handle the following encodings: Default Ansi codepage, Unicode, Unicode (Big-Endian) and UTF-8 with signature. Other encodings may cause effects such as compilation errors. This limitation is unlikely to cause trouble unless you have deliberately saved your source files in another encoding.

Auto-fix is available for projects created in Visual Basic 4.0, 5.0, 6.0 and .NET. Visual Basic 3.0 is not supported, neither is VBA.

©Aivosto Oy - Project Analyzer Help Contents