DevToys-app/DevToys · error · FileNotFoundException
Unable to find the indicated file.
Error message
Unable to find the indicated file.
What it means
Thrown by DevToys.Windows FileStorage.OpenReadFile after resolving a relative path against AppCacheDirectory and finding the file absent via File.Exists. It is the Windows platform's implementation of the shared IFileStorage.OpenReadFile contract. FileNotFoundException carries the resolved path.
Source
Thrown at src/app/dev/platforms/desktop/DevToys.Windows/Core/FileStorage.cs:36
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
return File.Exists(relativeOrAbsoluteFilePath);
}
public FileStream OpenReadFile(string relativeOrAbsoluteFilePath)
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
if (!File.Exists(relativeOrAbsoluteFilePath))
{
throw new FileNotFoundException("Unable to find the indicated file.", relativeOrAbsoluteFilePath);
}
return new FileStream(relativeOrAbsoluteFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, SandboxedFileReader.BufferSize, FileOptions.Asynchronous | FileOptions.SequentialScan);
}
public FileStream OpenWriteFile(string relativeOrAbsoluteFilePath, bool replaceIfExist)
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
if (File.Exists(relativeOrAbsoluteFilePath) && replaceIfExist)
{
File.Delete(relativeOrAbsoluteFilePath);
}
string parentDirectory = Path.GetDirectoryName(relativeOrAbsoluteFilePath)!;View on GitHub (pinned to 7e12df8448)
Solutions
- Call IFileStorage.FileExists(path) immediately before OpenReadFile and handle the false case.
- Inspect the resolved path (AppCacheDirectory + relative) to confirm it is the expected location.
- Ensure the producer (OpenWriteFile) completed before the consumer reads.
- For packaged/MSIX apps, confirm the path is inside the permitted app data folder.
- Catch FileNotFoundException and recover (recreate, reprompt, skip).
Example fix
// before
using FileStream stream = fileStorage.OpenReadFile(relativePath);
// after
if (!fileStorage.FileExists(relativePath))
{
return; // or recreate / reprompt
}
using FileStream stream = fileStorage.OpenReadFile(relativePath); Defensive patterns
Strategy: validation
Validate before calling
string resolved = Path.IsPathRooted(path) ? path : Path.Combine(fileStorage.AppCacheDirectory, path);
if (!File.Exists(resolved))
{
return; // or recreate / reprompt
}
using FileStream stream = fileStorage.OpenReadFile(path); Try / catch
try
{
using FileStream stream = fileStorage.OpenReadFile(path);
}
catch (FileNotFoundException ex)
{
// expected missing file — recreate or skip
} Prevention
- Precede OpenReadFile with FileExists; for packaged/MSIX apps confirm the path is inside the permitted app-data folder.
- Log the resolved path (AppCacheDirectory + relative) for missing-file diagnostics.
- Ensure the producer (OpenWriteFile) completed before the consumer reads.
- Catch FileNotFoundException at the call site and degrade gracefully.
When it happens
Trigger: Calling IFileStorage.OpenReadFile with a relative path that does not exist under AppCacheDirectory; an absolute path to a missing file; a file deleted between the existence check and the open (TOCTOU); a path that points into a location the packaged app cannot reach without broker access.
Common situations: MSIX/sandboxed app cache layout differing from dev; a file expected from a previous run that was cleaned on update; path with forward slashes or case that resolves differently; producer step failed so the file was never written.
Related errors
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- WebKitGTK could not be found. Please verify that the package
AI-assisted analysis of DevToys-app/DevToys@7e12df8448 (2026-08-13).
Data as JSON: /api/errors/8afa13afe18e2c0a.
Report an issue: GitHub.