JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++
C#
Third-Party External

CodeSonar Plug-in for Visual Studio: Viewing Analysis Results [Windows only]

Once you have installed the CodeSonar plug-in for Visual Studio and analyzed a project or imported an analysis, you can view the analysis results inside Visual Studio. The plug-in also provides functionality for editing warning properties.



Overview

The CodeSonar Visual Studio plug-in presents analysis results in the Visual Studio GUI.

Warning Markers and Highlighting

Information about the CodeSonar warnings issued in each source file is overlaid on the Visual Studio source listings, as shown in the following screenshot.

annotated screenshot fragment: file listing showing warning markers

Hiding and Showing Warning Markers

Warning markers and the corresponding location highlighting can be enabled and disabled from the CodeSonar menu (in the main Visual Studio menu bar).

Changing the Location Highlighting Style

The styling used for warning location highlighting can be enabled and disabled from the Options dialog.

  1. Select CodeSonar menu > Options.
  2. Select CodeSonar > Annotation Preferences from the tree menu.
  3. Use the tools provided to select a highlighting mechanism and color.
  4. Click OK.

Analysis Report View

The Analysis Report view provides information about a project's current analysis and its results.

The following annotated screenshot shows the various parts of an Analysis Report view.

annotated screenshot: Analysis Report view

Overview Tab

screenshot fragment: Overview tab

The Overview tab has two panels: one with analysis information, and one with links to additional information that is presented in the CodeSonar Web GUI.

Analysis Information Basic analysis properties:
Links

Links to information presented in the web GUI are divided into labeled sections.

Warnings Tab

screenshot fragment: Warnings tab

The Warnings tab contains a table of the warnings issued by the analysis, and provides functionality for searching and filtering these warnings.

table of warnings The warnings issued by the analysis, or a subset defined by the warning filter setting and the most recently executed search (if any). There is one row for each warning, with columns as follows.

Table rows are interactive:

  • Double-click a row to open the Warning view for the corresponding warning and the source file listing for the warning file.
  • Edit a warning's Priority, State, Finding, and Owner as follows.
    1. Click on the table row for the warning you want to modify.
      The Priority, State, Finding, and Owner values will be shown as menu selections.
    2. Click on the value you want to edit to display a menu of the available settings.
    3. Select a menu item to update the setting.
      The value will be updated on the hub.

The table can be sorted.

  • Click any column heading to sort by that column.
  • To specify sorting criteria directly, click the Warnings tab label, select Sort By, then use the sub-menu that opens to specify your search.
selecting classes If you only want to display warnings of certain classes:
  1. Click the Warnings tab label.
  2. Select Classes.
    The sub-menu that opens will list all warning classes for which at least one warning was issued by the analysis.
  3. Click list items to select (or deselect) them. Select All and Unselect All shortcuts are also provided.
The table contents will be updated to reflect your new selection.
warning search field To search within the set of warnings issued by the analysis:
  1. Enter a search term in the field. Terms may be plain text or conditions constructed using the warning search language.
  2. Press enter (or return).
The table contents will be updated to show only those warnings that satisfy the search constraints and any constraints imposed by the current warning filter selection and the classes selection. The search term will remain in the search field until you edit the field.
warning filter The options available from the Filter menu correspond to the names of saved searches in the Warning domain. Select a filter from the menu to filter the table contents according to the corresponding search constraints.

This menu corresponds to the Visible Warnings selector in the web GUI. See GUI Reference: Visibility Filter selector for information about the built-in filters and instructions for viewing the conditions associated with a saved search, removing a saved search, and creating a new saved search.

Files Tab

screenshot fragment: Files tab

The Files tab contains a table of the files analyzed by the analysis, and provides functionality for searching and filtering these files.

table of files The files in the analysis, or a subset defined by the file filter setting and the most recently executed search (if any). There is one row for each warning, with columns as follows. Table rows are interactive: double-click a row to open the corresponding file in Visual Studio.

The table can be sorted.

  • Click any column heading to sort by that column.
  • To specify sorting criteria directly, click the Files tab label, select Sort By, then use the sub-menu that opens to specify your search.
file search field To search within the set of files in the analysis:
  1. Enter a search term in the field. Terms may be plain text or conditions constructed using the file search language.
  2. Press enter (or return).
The table contents will be updated to show only those files that satisfy the search constraints and any constraints imposed by the current file filter selection. The search term will remain in the search field until you edit the field.
file filter The options available from the Filter menu correspond to the names of saved searches in the File domain. Select a filter from the menu to filter the table contents according to the corresponding search constraints.

This menu corresponds to the Visible Files selector in the web GUI. See GUI Reference: Visibility Filter selector for information about the built-in filters and instructions for viewing the conditions associated with a saved search, removing a saved search, and creating a new saved search.

Procedures Tab

screenshot fragment: Procedures tab

The Procedures tab contains a table of the procedures encountered by the analysis, and provides functionality for searching and filtering these procedures.

table of procedures The procedures in the analysis, or a subset defined by the procedure filter setting and the most recently executed search (if any). There is one row for each warning, with columns as follows. Table rows are interactive: double-click a row to open the file containing the corresponding procedure in Visual Studio.

The table can be sorted.

  • Click any column heading to sort by that column.
  • To specify sorting criteria directly, click the Procedures tab label, select Sort By, then use the sub-menu that opens to specify your search.
procedure search field To search within the set of procedures in the analysis:
  1. Enter a search term in the field. Terms may be plain text or conditions constructed using the procedure search language.
  2. Press enter (or return).
The table contents will be updated to show only those procedures that satisfy the search constraints and any constraints imposed by the current procedure filter selection. The search term will remain in the search field until you edit the field.
procedure filter The options available from the Filter menu correspond to the names of saved searches in the Procedure domain. Select a filter from the menu to filter the table contents according to the corresponding search constraints.

This menu corresponds to the Visible Procedures selector in the web GUI. See GUI Reference: Visibility Filter selector for information about the built-in filters and instructions for viewing the conditions associated with a saved search, removing a saved search, and creating a new saved search.

Warning View

The Warning view provides detailed information about a warning issued by the CodeSonar analysis.

The following annotated screenshot shows the various parts of an Analysis Report view.

annotated screenshot: Warning view

Code Tab

screenshot fragment: Code tab

The Code tab contains an annotated code excerpt that shows the context in which the warning was issued. CodeSonar provides additional information to explain the conditions leading to the warning and aid in diagnosis:

Path Names Provided at the top of the excerpt. Click to open the Visual Studio source listing for the file (if it is not already open).
Line Numbers Correspond directly to line numbers in the file. Click to open the Visual Studio source listing for the file (if it is not already open) and scroll to the specified line.
Explanation Information Significant locations in the excerpt are annotated.
  • All warnings have a warning description box summarizing the issue and the reason or reasons that it has arisen, with links to the code locations and annotations that are especially important.
  • Depending on the class of the warning, there may also be data annotations and control flow annotations.
  • If the excerpt includes a code location at which a parse error occurred, a parse error annotation is displayed at that location.
Interaction/Navigation Interaction and navigation functionality in the Code tab are as described in Warning Report: Interaction and Navigation
Source Coloring Along with syntax coloring (described in Source Coloring and Hyperlinking), the source excerpt has background coloring to aid in interpreting the warning.
  • Basic highlighting identifies code that is particularly relevant to the warning.

    If the warning is associated with an execution path, the highlighting shows the code on the warning's core path. For example, sometimes both parts of an if statement are highlighted because the statement is nested inside a loop, and the if condition evaluated to "true" in some iterations of the loop and "false" in others. (Use the control flow annotations to determine control flow in the last iteration.)

  • Red highlighting is used by some warning classes to identify the precise location at which the warning was issued. This is especially useful if the warning is issued at a source line that contains multiple statements.

Notes Tab

screenshot fragment: Notes tab

The Notes tab contains fields for viewing and editing the warning's user-modifiable properties, plus a change history. Note that all these properties apply to warning groups (not individual warning instances).

Priority, State, Finding, Owner Select a new values from the pull-down menus, and click OK. (New, custom values can be defined from the web GUI).
Note Enter a new note in the field, and click OK.
Change History The sequence of comments attached to this warning. These consist of all the user Notes added to the warning, plus all the messages automatically generated by CodeSonar when a user changes the warning's Priority, State, Finding, or Owner.

Hub Authentication

There are various situations in which you may need to sign in to the CodeSonar hub. For example:

The hub username and password are stored as project properties. There are two options for specifying the hub username and password for a project:

Hub Authentication Dialog

The hub authentication dialog will open if you attempt to modify a warning Priority/ State/Finding/Owner, or add a Note to a warning, for a project that does not already have a hub username and password stored as project properties.

screenshot: hub authentication dialog

  1. Check the hub location specified in the dialog to make sure that it has the value you expect. (If not, Cancel and then use the project properties dialog to make any necessary changes.)
  2. Do you have an account on this hub?
  3. Do you recall the account password?
  4. Enter your username and password in the dialog fields.
  5. Click OK.

The username and password you provide will be stored as project properties and used to authenticate future modifications for the same project.

Visual Studio Plug-in Links

The following sections provide detailed information about installing and using the CodeSonar plug-in for Visual Studio.

 

To report problems with this documentation, please visit https://support.codesecure.com/.