NickeManarin/ScreenToGif · error · FileNotFoundException
Impossible to open project.
Error message
Impossible to open project.
What it means
ImportFromProject throws FileNotFoundException when the extracted project folder contains neither Project.json nor List.sb. The archive was accepted by ZipFile.ExtractToDirectory but its contents do not match any known project layout.
Source
Thrown at ScreenToGif/Windows/Editor.xaml.cs:4115
if (File.Exists(Path.Combine(pathTemp, "Project.json")))
{
//Read as text.
var json = File.ReadAllText(Path.Combine(pathTemp, "Project.json"));
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))
{
var ser = new DataContractJsonSerializer(typeof(ProjectInfo));
var project = ser.ReadObject(ms) as ProjectInfo;
list = project?.Frames;
}
}
else
{
if (File.Exists(Path.Combine(pathTemp, "List.sb")))
throw new Exception("Project not compatible with this version");
throw new FileNotFoundException("Impossible to open project.", "List.sb");
}
//Shows the ProgressBar
ShowProgress(LocalizationHelper.Get("S.Editor.ImportingFrames"), list?.Count ?? 0);
var count = 0;
foreach (var frame in list ?? [])
{
//Change the file path to the current one.
frame.Path = Path.Combine(pathTemp, Path.GetFileName(frame.Path));
count++;
UpdateProgress(count);
}
return list;
}
catch (Exception ex)View on GitHub (pinned to a4d0a67c21)
Solutions
- Re-download or re-export the project file from its source.
- Inspect the extracted folder contents to confirm what is actually present (and the exact filename casing).
- If the manifest exists with different casing, normalize the lookup to be case-insensitive on Windows.
- Treat it as corruption if no manifest-shaped file exists and ask the user for a fresh copy.
Example fix
// before
throw new FileNotFoundException("Impossible to open project.", "List.sb");
// after
throw new FileNotFoundException($"Impossible to open project. Neither Project.json nor List.sb found in '{pathTemp}'. Archive contents: {string.Join(", ", Directory.GetFiles(pathTemp).Select(Path.GetFileName))}", "Project.json"); Defensive patterns
Strategy: validation
Validate before calling
var entries = Directory.GetFiles(pathTemp);
if (!entries.Any(f => Path.GetFileName(f).Equals("Project.json", StringComparison.OrdinalIgnoreCase) ||
Path.GetFileName(f).Equals("List.sb", StringComparison.OrdinalIgnoreCase)))
// warn user: archive has no recognizable manifest Type guard
static bool HasKnownManifest(string pathTemp) =>
Directory.GetFiles(pathTemp).Any(f =>
Path.GetFileName(f).Equals("Project.json", StringComparison.OrdinalIgnoreCase) ||
Path.GetFileName(f).Equals("List.sb", StringComparison.OrdinalIgnoreCase)); Try / catch
try { return ImportFromProject(source, pathTemp); }
catch (FileNotFoundException ex) when (ex.FileName == "List.sb" || ex.FileName == "Project.json")
{ /* ask the user for an uncorrupted project file */ } Prevention
- Validate the zip contains a known manifest before extracting.
- Use case-insensitive filename comparison on Windows to survive casing differences.
- Surface the actual folder contents in the error to speed diagnosis.
When it happens
Trigger: ZipFile.ExtractToDirectory succeeds, but File.Exists(Project.json) and File.Exists(List.sb) both return false.
Common situations: Corrupted/truncated project archive; manually-built zip without the manifest; archive from an incompatible fork/tool; antivirus stripped the manifest during extraction; case-sensitive mismatch (project.JSON) on a normalized filesystem.
Related errors
AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13).
Data as JSON: /api/errors/9975f2daf20b5e13.
Report an issue: GitHub.