6.5.4.1. Views

C#/.NET RFGs contain

  • a Code Facts view,

  • an Assembly view,

  • an Assembly Reference view,

  • an Entries view,

  • a Call view, and

  • an Include view.

Analyses might enrich the RFG with further views (e.g. a Dead / Alive view).

Code Facts View

The Code Facts view of a C#/.NET RFG contains nodes for types and their children as well as edges between them and edge-custom-attribute Custom_Attribute edges from all assemblies in the RFG. They are structured by node-namespace Namespace nodes.

Assembly View

The Assembly view of a C#/.NET RFG has the following structure:

  • On the top level there is one node of type node-assembly Assembly for each assembly used in the RFG.

  • Each node-assembly Assembly contains a namespace hierarchy containing all types that are defined within the assembly, and their children.

  • All edges between types and their children as well as edge-custom-attribute Custom_Attribute edges are represented in the Assembly view.

Both referenced assemblies as well as given source assemblies (from referenced projects and the main project itself) are represented in the Assembly view.

Caution

If no source assembly information has been provided at the creation of the IR from which the RFG is generated, the types not assigned to an assembly are collected in a ’default’ node-assembly Assembly named ?.

Entries View

The entry view of a C#/.NET RFG is similar to the one created for C or C++ projects: it contains entry points of programs (like the Main function of executables), and also entities which should be considered ’initially alive’ by analyses like the dead code analysis. For a library project, all methods having the access modifier public or protected or protected internal from assemblies that are not actually referenced by another assembly in the project are contained in this view by default.

Call View

The Call view of a C#/.NET RFG is similar to the one created for C or C++ projects: Its nodes represent routines. Edges between nodes A and B represent that A calls B or that the address of B is taken in A. The view is useful for detecting call cycles in the program.

Assembly Reference View

The Assembly Reference view is used to represent dependencies between reference assemblies as well as source assemblies. It contains the following elements as follows:

  • For each source or reference assembly represented in the RFG, a node-assembly Assembly node is contained in the view; these nodes are the same as the top-level nodes of the Assembly view.

  • A “default” node-assembly Assembly (named ?). It might contain unresolved references, special types like the dynamic type, or all types from source code if no source assembly information has been provided.

  • For each pair A, B of assemblies such that A references B (by using one of its types and/or type members etc.), there exists an edge A→B of type Assembly_Reference in the view.

  • Nothing else is contained in the Assembly Reference view.

Include View

The Include view of a C#/.NET RFG is similar to the one created for C or C++ projects: Its nodes represent directories and files whose content form the source code basis of the analyzed project.