.NET#

The .NET module supports the ability to read in one or more .NET assemblies, contained in .exe or .dll files.

Options#

Member Level Processing#

Using Architect’s member level functionality, classes and interfaces can be further expanded down to nested classes, methods and fields. The default option (Do Not Load Members) is the preferred option, because the member level information is available even after the project is loaded.

Include classes matching these package prefixes#

Allows you to specify a prefix and only those classes and interfaces which match that prefix are loaded.

Exclude classes containing these strings#

Allows you to exclude classes and interfaces whose name contains a specified string. You can use this to exclude classes and interfaces which contain strings such as “test” or “temp” etc.

Logfile Name#

The Logfile Name option allows you to analyze the .NET module’s processing during dependency generation. Entering a file name here causes the .NET module to generate a log of its processing. Using this option greatly degrades the performance of the module’s processing and can generate very large files.

You can use the logger to determine the .NET construct that created a particular dependency. The logger dumps the contents of an assembly interspersed with dependency generation information. For example:

FILE: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AspNetMMCExt.dll
   :
   :
  class Microsoft.Aspnet.Snapin.About
CREATEATOM: Microsoft.Aspnet.Snapin.About
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses System.Object (extends)
  extends System.Object
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses Microsoft.Aspnet.Snapin.ISnapinAbout (implements)
  implements Microsoft.Aspnet.Snapin.ISnapinAbout
    I m_hMainIcon
    I m_hMainBMP16
    I m_hMainBMP32
    [METHOD: 6] void .ctor()
FAT - headerWord: 0x3 headerSize: 3 codeOffset: 0x10dc maxStackSize: 4 bodySize:
 0x6f idxLocalVarSig: 0x11000001
  locals:
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses System.Drawing.Bitmap (class)
    [1] System.Drawing.Bitmap
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses System.Drawing.Bitmap (class)
    [2] System.Drawing.Bitmap
    [3] I
        L_00000000: (0x02) ldarg.0
        L_00000001: (0x28 19 00 00 0a) call System.Object::.ctor
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses System.Object (constructs)
        L_00000006: (0x72 01 00 00 70) ldstr 70000001
        L_0000000b: (0x28 83 01 00 06) call Microsoft.Aspnet.Snapin.Resource::GetBitmap
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses Microsoft.Aspnet.Snapin.Resource(method)
        L_00000010: (0x0a) stloc.0
        L_00000011: (0x72 13 00 00 70) ldstr 70000013
        L_00000016: (0x28 83 01 00 06) call Microsoft.Aspnet.Snapin.Resource::GetBitmap
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses Microsoft.Aspnet.Snapin.Resource(method)
        L_0000001b: (0x0b) stloc.1
        L_0000001c: (0x02) ldarg.0
        L_0000001d: (0x06) ldloc.0
        L_0000001e: (0x6f 1a 00 00 0a) callvirt System.Drawing.Bitmap::GetHicon
DEPENDENCY: Microsoft.Aspnet.Snapin.About uses System.Drawing.Bitmap (virtual method)

This log excerpt shows a number of dependencies and the .NET construct that generated them.

The FILE line (which occurs somewhat earlier in this log) tells the file that contained the generated dependency.

The CREATEATOM line shows the creation of an Atom atom in the project in response to the …About. class found in the assembly.

DEPENDENCY lines generated dependencies. The term in parenthesis is the kind of dependency generated.

Lines of the form L_00000xxx: show CIL code extracted from the assembly.

Partition Options#

Create Subsystems for Assemblies

This is enabled by default. As a result, the default partitioning shows assemblies (dlls/exes) at the top level, and then each assembly can be further expanded showing its organization by namespaces and classes.

If this option is disabled, the top level will show the organization by namespace. All the classes in all the assemblies will now be organized by namespace and may be intermixed together. If the assemblies have duplicate classes then you will see multiple partitions. A different option Merge Duplicate Atoms used in conjunction with this option can merge the multiple classes under a single partition.

Create Subsystems Corresponding to Directory Structure

This option is useful when you have a large number of assemblies in different directories. The project is still organized by assemblies but partitions are created to reflect the directory structure where the assemblies are found. As a result, multiple assemblies within a directory will be grouped under a partition reflecting the directory.

Atom Types and Dependency Kinds#

The .NET module generates a number of atom types and dependency kinds. This enables filtering, rule specification and usage display based on the value of atom types and dependency kinds.

The .NET module generates the following types of atoms:

  • Class

  • Interface

  • Method

  • Field

  • Nested Class

The .NET module generates the following kinds of dependencies:

  • Class Reference: Reference to class name

  • Invokes: Method call - there are three subkinds: virtual method, method, and static method

  • Inherits: Inheritance - there are two subkinds: inherits, implements

  • Data Member Reference: Reference to a field - there are two subkinds: field reference, static field (reference to a static field in a class or an interface)

  • Constructs: Constructor call

  • Event: Event dependency - there are 4 subkinds: fire, remove, add, other

  • Property: Property dependency - there are 3 subkinds: get, set, other

Source code mapping#

The .Net module uses the Debug Interface Access (DIA) SDK from Microsoft to map code to source files. This allows using the View Source context menu to view the code for dependencies and atoms in the model. If you have Visual Studio installed, the .Net module should interface seamlessly with it.

If you do not have the DIA SDK installed, View Source functionality will be disabled (i.e. grey context menu).

For Visual Studio 2019, the DIA SDK should be installed in (depending on which version of Visual Studio 2019 you have installed)

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\DIA SDK

or

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK

If the “View Source” is not working in Lattix, you might need to register the msdial140.dll which is found in the DIA SDKbin directory

Start a cmd prompt as Administrator

cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64
regsvr32 msdia140.dll

PDB file processing is disabled by default on new projects. This means line number and filename information will not be captured unless this option is explicitly enabled.

If the user does want line numbers the following conditions apply:

  • Project must be built on Windows using Visual Studio

  • If the project is a .NET Framework project it should be built in debug mode and ensure that a pdb file is being produced

  • If the project is a .NET Core project then (2) applies but additionally the pdb debugging output MUST be set to full

image0

Limitations#

None at this time :).

ldcupdate example with solution file#

Example command line for processing Visual Studio solution file#

When using the ldcupdate command line with a dotnet project, you can specify a solution file as a datasource. You will need to specify the datasource kind "vs-sln-file"
and also specify the datasource properties "sln_name" and "sln_cfg"
Here is an example:
ldcupdate project.ldz -module:dotnet vs-sln-file:sln_name=vsproject,sln_cfg=Debug|x86

The vs-sln-file prefix before the “:” specifies the datasource kind. The data after the “:” specifies the datasource itself, which in this case consists of 2 properties (sln_name and sln_cfg) and their values. The properties are separated by a comma