Troubleshooting Crashes with Microsoft Application Verifier: Step‑by‑Step

Integrating Microsoft Application Verifier into Your CI Pipeline

Overview

Add Application Verifier (AppVerifier) runs to automated builds to catch memory, handle, and API misuse issues early. Typical flow: install AppVerifier on agent → enable desired checks for the target binary → run tests/executable under AppVerifier → collect and fail build on violations → archive logs.

Steps (assume Windows self‑hosted CI agent)

  1. Install AppVerifier on agent

    • Install Windows SDK or AppVerifier package so appverif.exe is available.
  2. Prepare checks

    • Create an Application Verifier configuration (registry keys) or use appverif.exe to enable checks for your executable:
      • Example enabling standard checks:

        Code

        appverif.exe /enable Default /for MyApp.exe
      • Or enable specific tests (Handles, Heaps, Locks, etc.):

        Code

        appverif.exe /enable Handles Heaps Locks /for MyApp.exe
  3. Run the app under AppVerifier during test stage

    • Start the application or test runner; AppVerifier injects runtime checks automatically.
    • For GUI/long‑running apps, run integration tests or a smoke test that exercises code paths.
  4. Collect and fail on errors

    • AppVerifier reports issues via:
      • Event Viewer (Application/System) — look for “Application Verifier” events.
      • Debugger breakpoints (configure to log instead in CI).
      • Output files created by your test harness (you can parse Event Log).
    • In CI script, query Windows Event Log after test run and fail build if verifier events found:

      Code

      # PowerShell example: fail if any Application Verifier events \(events = Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='Microsoft-Windows-AppVerifier'} -MaxEvents 100 if (\)events) { Write-Error “AppVerifier issues found”; exit 1 }
  5. Make results actionable

    • Save Event Log export or AppVerifier XML/trace artifacts to build artifacts.
    • Include stack traces + crash dumps (enable mini‑dumps) for triage.
  6. Integrate with CI systems

    • Jenkins: run appverif and tests in Windows node, parse Event Log in post‑build step; fail job on findings.
    • Azure Pipelines: use Windows self‑hosted agent, add PowerShell steps to enable checks, run tests, collect Event Log, publish artifacts, and fail pipeline on errors.
    • GitHub Actions: use windows‑runner (self‑hosted for persistent AppVerifier install) or install Windows SDK at job start; use steps like above to enable, run, and parse events.

Practical tips

  • Limit checks for CI (target high‑value checks) to reduce false positives and test flakiness.
  • Use deterministic, automated tests that exercise problematic code paths.
  • Disable debugger popups on CI (so runs don’t hang on breakpoints).
  • Rotate or reset AppVerifier settings between builds (appverif.exe /remove or clear registry) to avoid cross‑build contamination.
  • Capture full crash dumps and symbol files to make stack traces usable.

If you want, I can produce ready‑to‑paste PowerShell snippets for Jenkins, Azure Pipelines, or GitHub Actions that enable AppVerifier, run tests, and fail on verifier events.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *