Table of Contents

CoverletMtpDebugConstants Class

Definition

Environment variable names for debugging and tracing coverlet.MTP.

public static class CoverletMtpDebugConstants
Inheritance
CoverletMtpDebugConstants

Examples

Run a diagnostic operation with tracker logging enabled, then restore the previous process environment even if it fails. Invoke this wrapper before the test process is created so the child can inherit the switch. Environment changes are process-wide, so serialize this operation with other tooling that changes the same variable.

using System;
using Coverlet.MTP.Diagnostics;

namespace CoverageTools.Diagnostics;

public static class TrackerLogging
{
    public static void Run(Action launchDiagnosticRun)
    {
        string variable = CoverletMtpDebugConstants.EnableTrackerLog;
        string? previous = Environment.GetEnvironmentVariable(variable);
        try
        {
            Environment.SetEnvironmentVariable(variable, "1");
            launchDiagnosticRun();
        }
        finally
        {
            Environment.SetEnvironmentVariable(variable, previous);
        }
    }
}

Fields

Name Description
CollectionDebug

Enable coverage result collection debugging. Set to "1" to enable.

DebugLaunch

Enable debugger launch popup when coverage extension initializes. Set to "1" to enable.

DebugWaitForAttach

Enable wait loop for debugger attach during extension initialization. Set to "1" to enable. Extension will wait until debugger is attached.

EnableTrackerLog

Enable detailed tracker logging for instrumented modules. Set to "1" to enable. Logs will be written near module location.

ExceptionLogEnabled

Enable exception logging for coverage operations. Set to "1" to enable detailed exception logging.

InstrumentationDebug

Enable verbose instrumentation logging. Set to "1" to enable detailed instrumentation diagnostics.