How To Profile A Native DLL Called From A C# Application

How To Profile A Native DLL Called From A C# Application


Profiling a DLL called from a .NET application is fairly straightforward. In this example, I will demonstrate how to profile a DLL called from a simple C# winform.


    1.  Instrument your native code with Error Detection
      **If you would like to know how to build and instrument from the command line, view the knowledgebase article located here:

    2. From the menu of Visual Studio, select "Devpartner>C++ Instrumentation Manager".

    3. Proceed to build your DLL project in Visual Studio.
    4. Navigate to the standalone version of Error Detection: Start>Programs>Micro Focus> DevPartner>Error Detection.

    5. Click File>Open and navigate to the executable that will invoke your DLL.

    6. Click on Program and then Settings.

    7. Navigate to Modules and Files.

    8. From the Modules and Files Property Page, click Add Module and select the DLL you want to profile.

    9. Click Ok.

    10. To  start, click on the Play button or navigate to Program>StartProgram>Start.

      At this point, if you have instrumented your native code, Error Detection will begin the process of profiling your application for errors, memory leaks, etc.

      For example, the application that I created is nothing more than a simple C++ DLL of which a memory leak, and a buffer overrun was added.

      During the execution of my simple example, Error Detection reported the following:

      Memory Leak Generated in DLL Code

      Write Over Run Generated from DLL Code


      *Note: If you are not seeing any profiled data.  Locate your native DLL in the "Modules Tab" of the session file to verify instrumentation.



Labels (1)


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
2 of 2
Last update:
‎2020-01-23 21:43
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.