beeradmoore/dlss-swapper · error · Exception

GamePage_DllPicker_CouldNotFindFileTemplate

Error message

GamePage_DllPicker_CouldNotFindFileTemplate

What it means

DLLPickerControlModel.OpenDllPath tries to open the folder containing the game asset's DLL in Windows Explorer; when the resolved dllPath directory does not exist it throws a localized 'could not find file' exception formatted with the asset path. It signals the DLL file/folder recorded for the game is gone from disk.

Solutions

  1. Verify the path exists on disk; reinstall or relocate the game/mod so the DLL folder is present.
  2. Re-select or re-import the DLL in the Library/Game page so the stored path is updated to the current location.
  3. Edit the game asset entry to correct the stale Path value.
  4. Check drive letters/mounts — the path may reference a drive that isn't currently connected.

Example fix

// before: stale stored path
await model.OpenDllPath(); // throws if folder was moved
// after: verify and refresh first
if (!Directory.Exists(Path.GetDirectoryName(CurrentGameAsset.Path)))
    await ReImportDllAsync(CurrentGameAsset); // refresh stored path
else
    await model.OpenDllPath();
Defensive patterns

Strategy: validation

Validate before calling

var dir = Path.GetDirectoryName(CurrentGameAsset.Path);
bool canOpen = Directory.Exists(dir);
if (canOpen) Process.Start("explorer.exe", dir);

Type guard

static bool DllPathExists(string path) => !string.IsNullOrWhiteSpace(path) && Directory.Exists(Path.GetDirectoryName(path));

Try / catch

try { await picker.OpenDllPath(); }
catch (Exception ex) when (ex.Message.Contains("CouldNotFindFile"))
{ Logger.Error(ex); PromptReImportDll(CurrentGameAsset); }

Prevention

When it happens

Trigger: Calling OpenDllPath for a game asset whose CurrentGameAsset.Path points to a directory (or file whose folder) that no longer exists — the else branch after Directory.Exists(dllPath) fails.

Common situations: The game or mod was uninstalled/moved after being added to the library; path stored with a different drive letter or profile; OneDrive/cloud folder moved; user deleted the mod folder manually.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of beeradmoore/dlss-swapper@ab9b1e2d4b (2026-09-15). Data as JSON: /api/errors/f73293cbcd9a055c. Report an issue: GitHub.

Appendix: source

Thrown at src/UserControls/DLLPickerControlModel.cs:321

            return;
        }

        try
        {
            if (File.Exists(CurrentGameAsset.Path))
            {
                Process.Start("explorer.exe", $"/select,{CurrentGameAsset.Path}");
            }
            else
            {
                var dllPath = Path.GetDirectoryName(CurrentGameAsset.Path) ?? string.Empty;
                if (Directory.Exists(dllPath))
                {
                    Process.Start("explorer.exe", dllPath);
                }
                else
                {
                    throw new Exception(ResourceHelper.GetFormattedResourceTemplate("GamePage_DllPicker_CouldNotFindFileTemplate", CurrentGameAsset.Path));
                }
            }
        }
        catch (Exception err)
        {
            Logger.Error(err);
            ShowTempInfoBar(ResourceHelper.GetString("General_Error"), err.Message, severity: InfoBarSeverity.Error);
        }
    }

    [RelayCommand]
    async Task ResetDllAsync()
    {
        var didReset = await Game.ResetDllAsync(GameAssetType);

        if (didReset.Success == true)
        {
            if (_parentDialogWeakReference.TryGetTarget(out var parentDialog) == true)

View on GitHub (pinned to ab9b1e2d4b)