Archive

Archive for the ‘Code Analysis’ Category

Code Issues fixes and suppression

July 25th, 2011 2 comments

Code Issues can be easily fixed with the corresponding code fixes. The code fixes are operations that allow you to automatically fix the issue by changing the source code, so the issue is no longer valid for the block of code in question. The code fixes are refactoring or code providers assigned to the code issues as fixes.

There are several ways to fix an issue:

  1. Code Fix hint
  2. Zoom Window
  3. Manually apply a fix

Read more…

Code Issues navigation techniques

July 25th, 2011 Comments off

Analyzing the quality of your source code may take some time, especially if there are hundreds or thousands of code issues. While checking the code issues, you have to navigate thought all of them inside the entire solution. Here are available navigation techniques to switch between code issues:

  1. Code Fix hint
  2. Keyboard shortcuts
  3. Code Issues tool window

Read more…

Code Issues – Undisposed local

July 13th, 2011 Comments off

The Undisposed local code issue of the warning type highlights local variables that implement the System.IDisposable interface and are not explicitly disposed. The IDisposable interface was designed to provide a standard way to release unmanaged resources by calling its Dispose method. If the object is IDisposable, it is a good idea to dispose of it when you no longer need it, especially if the object uses unmanaged resources. These are resources that the .NET garbage collector does not manage on our behalf and is unable to clean-up automatically. They include items such as streams, files, database connections, handles and other operating system objects. If the memory and system resources that they use are not properly released, a program may suffer from memory leaks or problems due to locked resources.

Read more…

CodeRush Code Issues specific to extension methods

July 11th, 2011 Comments off

Extension methods allow developers to expand existing types without having to sub-class, recompile or modify the original type. They were introduced as a feature of CSharp version 3.0 and Visual Basic version 9.0. Such methods are just like static methods invoked by using instance method syntax.

Read more…

Code Issues – Redundant namespace reference

June 30th, 2011 Comments off

Cause:

The Redundant namespace reference code issue highlights unused namespace references that can be safely removed in gray (dead code issue), which may improve readability.

Read more…

Code Issues specific for static classes

June 23rd, 2011 Comments off

A static class can be used as a unit of organization for sets of utility functions that operate on input parameters and do not have to get or set any internal data. These functions can be accessed without creating an instance of the class. In this case, a static class can make your implementation simpler and faster because you do not have to create an object in order to call its methods.

Read more…

Code Issues tool window

June 20th, 2011 3 comments

The CodeRush Code Issues tool window shows a summary of code issues found inside the source code within an entire solution. It is intended to help you overview, analyze, navigate and fix issues such as errors, warnings, hints and dead code:

Read more…

Code Issues configuration and options

May 30th, 2011 Comments off

CodeRush Code Issues configuration is available inside the IDE Tools Options Dialog and also in the Options Dialog of the Visual Studio. The main set of options is located on the Editor | Code Analysis | Code Issues options page:

Read more…