App Verifier
App Verifier is a runtime verification tool that helps developers detect and diagnose application compatibility issues and runtime errors. It monitors applications for common programming errors that can lead to instability, security vulnerabilities, or incorrect behavior.
Key Features
- Heap Corruption Detection: Identifies memory corruption errors such as buffer overflows, underflows, and use-after-free conditions.
- Handle Leak Detection: Tracks the usage of operating system handles (e.g., file handles, registry keys) and reports any leaks.
- Lock Order Deadlock Detection: Analyzes the use of critical sections and other synchronization primitives to find potential deadlocks.
- Resource Leak Detection: Monitors the allocation and deallocation of various system resources.
- Application Compatibility Checks: Validates applications against Windows compatibility standards.
- Application Isolation Verification: Helps ensure applications correctly implement isolation mechanisms.
How it Works
App Verifier works by instrumenting the application's code at runtime. It intercepts calls to system APIs and checks for common error patterns. When a potential issue is detected, App Verifier logs detailed information that can be used for debugging.
Getting Started
- Download App Verifier: App Verifier is typically included as part of the Windows Software Development Kit (SDK).
- Install App Verifier: Follow the installation instructions provided with the SDK.
- Launch App Verifier: You can launch App Verifier from the Start Menu or by running
appverif.exe
. - Configure Application: In App Verifier, add the executable of the application you want to test.
- Select Verification Tests: Choose the specific tests you want to enable for your application. It's recommended to start with a basic set and gradually enable more.
- Run Your Application: Launch your application as you normally would. App Verifier will run in the background.
- Analyze Results: If App Verifier detects any issues, it will generate a report or break into the debugger, providing call stacks and other diagnostic information.
Common Verification Tests
App Verifier offers a variety of tests, including:
- Basic Verifier: A foundational set of tests for common runtime errors.
- Heap Verifier: Specifically targets heap corruption issues.
- Lock Order Verifier: For detecting synchronization deadlocks.
- Handle Verifier: Detects handle leaks.
- Application Compatibility Verifier: Checks for adherence to compatibility guidelines.
Best Practices
- Run App Verifier on debug builds whenever possible.
- Start with the "Basic Verifier" and "Heap Verifier" as they catch many common issues.
- Enable tests incrementally to avoid overwhelming the system and to pinpoint the source of errors more easily.
- Always analyze the full call stack provided by App Verifier to understand the context of the error.
- Integrate App Verifier into your automated testing pipelines for continuous verification.