Coding Problem Indicators

The Visual Studio compiler works in conjunction with the code editor window to flag any problems found within a source code document. The compiler can even work in the background, enabling the editor window to flag problems as you type (as opposed to waiting for the project to be compiled).

Coding problems are flagged using “squiggles” (wavy, color-coded lines placed under the offending piece of code). These squiggles are the same mechanism Microsoft Word uses to flag spelling and grammar problems. The squiggle colors indicate a specific class of problem. Table 7.1 shows how these colors map to an underlying problem.

Image

TABLE 7.1 Coding Problem Indicator Colors

Hovering the mouse pointer over the problem indicator reveals the actual compiler error or warning message, as demonstrated in Figure 7.4. You will also be presented with a list of potential fixes to the issue. Note the hyperlink in the message box: Show potential fixes. Clicking on this will provide access to a number of refactoring options that could solve the code issue. For example, perhaps you are trying to reference an object type that doesn’t exist. This could be a simple typo, or you could be attempting to refer to an object that you haven’t defined yet. In the latter case, this “potential fixes” refactoring window can inject the code necessary to create a stub of the object and will even show you a small preview of what that code looks like (Figure 7.5).

Image

FIGURE 7.4 Code problem indicators.

Image

FIGURE 7.5 Refactoring a coding issue.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset