6.5.4.1. Views

C#/.NET RFGs include:

  • a Code Facts view,

  • an Assembly view,

  • an Assembly References 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, edges between them, and edge-custom-attribute Custom_Attribute edges from all assemblies in the RFG. These are structured by node-namespace Namespace nodes.

Assembly View

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

  • At the top level, there is one node-assembly Assembly node for each assembly used in the RFG.

  • Each node-assembly Assembly contains a namespace hierarchy including all types 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 and source assemblies (from referenced projects and the main project itself) are represented in the Assembly view.

Caution

If no source assembly information was provided when creating the C# package file (.cspkg) from which the RFG is generated, types not assigned to an assembly are collected in a ‘default’ node-assembly Assembly named ?.

Entries View

The Entries view of a C#/.NET RFG is similar to the one created for C or C++ projects: it contains program entry points (such as the Main function of executables) and entities that should be considered ‘initially alive’ by analyses such as dead code analysis. By default, the view contains the entry point of each source assembly, all static constructors, finalizers and explicit interface implementations, and all non-abstract methods of referenced assemblies. For library projects, it also contains all methods with the access modifier public, protected, internal, or protected internal.

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, and edges between nodes A and B indicate that A calls B. This view is useful for detecting call cycles in the program.

Assembly References View

The Assembly References view represents dependencies between reference assemblies and source assemblies. It contains the following elements:

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

  • A ‘default’ node-assembly Assembly (named ?), which may contain unresolved references, special types such as the dynamic type, or all types from source code if no source assembly information was provided.

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

  • No other elements are contained in the Assembly References 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 contents form the source code basis of the analyzed project.