stride3d/stride · error · DirectoryNotFoundException

Microsoft PIX not found under

Error message

Microsoft PIX not found under "{programFilesPath}".

What it means

Thrown by WinPixNative.LoadPixGpuCapturer when the Program Files folder resolves but the subdirectory "Microsoft PIX" does not exist there — i.e. PIX is not installed (or installed to a non-standard location), so WinPixGpuCapturer.dll cannot be found.

Solutions

  1. Install Microsoft PIX (from the official PIX site) so "<ProgramFiles>\Microsoft PIX" exists.
  2. Verify PIX was installed machine-wide and not only to a per-user/alternate directory.
  3. Disable PIX GPU capture when PIX is not installed, or wrap the capture setup in try/catch for DirectoryNotFoundException.
  4. Set/keep the %ProgramFiles% environment variable intact so the combined path resolves.

Example fix

// before
GraphicsDeviceFactory.EnableGPUCaptureAssertions = true; // crashes if PIX missing
// after
try { GraphicsDeviceFactory.EnableGPUCaptureAssertions = true; }
catch (DirectoryNotFoundException) { /* PIX not installed; skip capture */ }
Defensive patterns

Strategy: fallback

Validate before calling

var pixDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft PIX");
if (!Directory.Exists(pixDir))
{
    log.Warn("Microsoft PIX not installed; GPU capture disabled");
    return;
}

Type guard

bool IsPixInstalled() =>
    OperatingSystem.IsWindows()
    && Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft PIX"));

Try / catch

try { WinPixNative.Initialize(); }
catch (DirectoryNotFoundException ex) { log.Warn("Install Microsoft PIX for GPU capture: " + ex.Message); }

Prevention

When it happens

Trigger: Requesting a PIX GPU capture while Microsoft PIX is not installed in C:\Program Files\Microsoft PIX — e.g. fresh dev machines, only the standalone PIX app installed elsewhere, or PIX removed after an update.

Common situations: New workstations without PIX; PIX installed per-user (not under Program Files); running the capture-enabled debug build on a colleague's or CI machine that lacks PIX.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/2d1226f654802bd4. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D12/WinPixNative.cs:88

    {
        IntPtr moduleHandle = GetModuleHandle(CapturerDllName);
        if (moduleHandle == IntPtr.Zero)
        {
            LoadLibrary(GetLatestWinPixGpuCapturerPath());
        }

        //
        // Helper to locate the latest installed "WinPixGpuCapturer.dll".
        //
        static string GetLatestWinPixGpuCapturerPath()
        {
            string programFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            if (string.IsNullOrEmpty(programFilesPath))
                throw new DirectoryNotFoundException("Could not locate \"Program Files\" folder.");

            string pixInstallationPath = Path.Combine(programFilesPath, "Microsoft PIX");
            if (!Directory.Exists(pixInstallationPath))
                throw new DirectoryNotFoundException($"Microsoft PIX not found under \"{programFilesPath}\".");

            string newestVersionFound = null;

            // Enumerate all subdirectories, looking for the one with the highest version number
            foreach (var dir in Directory.EnumerateDirectories(pixInstallationPath))
            {
                var dirName = Path.GetFileName(dir);
                if (string.IsNullOrEmpty(dirName))
                    continue;

                if (newestVersionFound is null || string.CompareOrdinal(newestVersionFound, dirName) < 0)
                {
                    newestVersionFound = dirName;
                }
            }

            if (string.IsNullOrEmpty(newestVersionFound))
                throw new InvalidOperationException("No PIX installation found.");

View on GitHub (pinned to 96fad776d2)