How to fix "module was not instrumented." Reason:"path_is_excluded" error in Microsoft.CodeCoverage.Console tool?

R M 0 Reputation points
2024-06-13T06:50:10.2966667+00:00

I'm receiving the following problem while trying to instrument my dll with Microsoft.CodeCoverage.Console tool. module was not instrumented. Reason: path_is_excluded."

I'm using Microsoft.CodeCoverage.A console tool for calculating code coverage. When I execute the instrument command with my dll, I receive the message module was not instrumented. Reason: path_is_excluded.

I absorbed the dll that ends with Clr, and the error is being generated.

(Example: MyProjectClr.dll, MyProject.CLR.dll)

Even I tried the following .runsettings file

<?xml version="1.0" encoding="utf-8"?>

<RunSettings>

<DataCollectionRunSettings>

<DataCollectors>

<DataCollector friendlyName="Code Coverage">

<Configuration>

<CodeCoverage>

<ModulePaths>

<Include>

<!-- Include all DLLs -->

<ModulePath>.*</ModulePath>

<!-- Explicitly include DLLs ending with CLR.dll -->

<ModulePath>.*CLR.dll$</ModulePath>

</Include>

</ModulePaths>

</CodeCoverage>

</Configuration>

</DataCollector>

</DataCollectors>

</DataCollectionRunSettings>

</RunSettings>

It is not working. What has to be done to resolve this issue?

i am using VS 2022 Enterprise edition and dll and pdb patched properly. remaining all dlls which not end with the name CLR its working fine

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,934 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,211 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,765 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
351 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 29,841 Reputation points Microsoft Vendor
    2024-06-25T08:41:44.1133333+00:00

    Hello, please try change <ModulePaths> to <ModulePaths mergeDefaults="false"> in .runsettings file.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.