Tichau/FileConverter · error · Exception

Can't retrieve file converter registry entry.

Error message

Can't retrieve file converter registry entry.

What it means

PathHelpers.FileConverterRegistryKey (FileConverterExtension project) throws Exception when Registry.CurrentUser.OpenSubKey(@"Software\FileConverter") returns null — i.e. the HKCU\Software\FileConverter key does not exist for the current user. The shell extension reads this key (and its 'Path' string value via FileConverterPath) to locate the installed FileConverter.exe, so the throw means the host application is not registered for this user. Because it is a plain throw in a static property getter, any caller that touches FileConverterRegistryKey, FileConverterPath or DefaultSettingsFilePath will propagate the exception (potentially crashing the explorer.exe-hosted shell extension).

Source

Thrown at Application/FileConverterExtension/PathHelpers.cs:39

                if (string.IsNullOrEmpty(pathToFileConverterExecutable))
                {
                    return null;
                }

                return Path.Combine(Path.GetDirectoryName(pathToFileConverterExecutable), "Settings.default.xml");
            }
        }

        public static RegistryKey FileConverterRegistryKey
        {
            get
            {
                if (PathHelpers.fileConverterRegistryKey == null)
                {
                    PathHelpers.fileConverterRegistryKey = Registry.CurrentUser.OpenSubKey(@"Software\FileConverter");
                    if (PathHelpers.fileConverterRegistryKey == null)
                    {
                        throw new Exception("Can't retrieve file converter registry entry.");
                    }
                }

                return PathHelpers.fileConverterRegistryKey;
            }
        }

        public static string FileConverterPath
        {
            get
            {
                if (string.IsNullOrEmpty(PathHelpers.fileConverterPath))
                {
                    PathHelpers.fileConverterPath = PathHelpers.FileConverterRegistryKey.GetValue("Path") as string;
                }

                return PathHelpers.fileConverterPath;
            }

View on GitHub (pinned to 6c157a411f)

Solutions

  1. Run the FileConverter installer for the current user so it creates HKCU\Software\FileConverter with the 'Path' value pointing at FileConverter.exe.
  2. If already installed, verify the key exists (reg query HKCU\Software\FileConverter) and that its 'Path' value is correct; re-run the installer / repair if missing.
  3. For a per-machine install that wrote HKLM, either install per-user or mirror the key into HKCU.
  4. In extension code, wrap every PathHelpers access in try/catch and degrade gracefully (disable context-menu items) instead of letting the throw escape into explorer.
  5. Manually create the key as a last resort: set HKCU\Software\FileConverter\Path = full path to FileConverter.exe.

Example fix

// before (extension entry point)
string exePath = PathHelpers.FileConverterPath; // throws if key absent

// after
string exePath;
try
{
    exePath = PathHelpers.FileConverterPath;
}
catch (Exception ex) when (ex.Message.Contains("registry entry"))
{
    // FileConverter not installed for this user; disable shell features.
    exePath = null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

using Microsoft.Win32;

// Probe before relying on PathHelpers
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\FileConverter"))
{
    if (key == null || string.IsNullOrEmpty(key.GetValue("Path") as string))
    {
        // FileConverter is not installed for this user; disable shell features.
        return;
    }
}

string exePath = PathHelpers.FileConverterPath;

Type guard

private static bool IsFileConverterInstalled() =>
    Registry.CurrentUser.OpenSubKey(@"Software\FileConverter")?.GetValue("Path") as string != null;

Try / catch

string exePath;
try
{
    exePath = PathHelpers.FileConverterPath;
}
catch (Exception ex) when (ex.Message.Contains("registry entry"))
{
    // HKCU\Software\FileConverter missing: degrade gracefully instead of crashing the shell.
    logger.Warn(ex, "FileConverter registry key absent; extension disabled.");
    exePath = null;
}

Prevention

When it happens

Trigger: Accessing PathHelpers.FileConverterPath, PathHelpers.DefaultSettingsFilePath or PathHelpers.UserSettingsFilePath-adjacent code when HKCU\Software\FileConverter is absent; the FileConverter shell extension DLL is registered but the host app was never installed (or was uninstalled) for the current user; running the extension under a different user account than the one that ran the installer.

Common situations: App never installed on the machine; app uninstalled but the shell extension DLL still registered; per-machine install that wrote HKLM\Software\FileConverter instead of HKCU; the installer failed to write the registry 'Path' value; running as a different user than the installer user.

Related errors


AI-assisted analysis of Tichau/FileConverter@6c157a411f (2026-08-13). Data as JSON: /api/errors/e096822e53bb9bb6. Report an issue: GitHub.