{"record":{"id":"9975f2daf20b5e13","repo":"NickeManarin/ScreenToGif","slug":"impossible-to-open-project","errorCode":null,"errorMessage":"Impossible to open project.","messagePattern":"Impossible to open project\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"ScreenToGif/Windows/Editor.xaml.cs","lineNumber":4115,"sourceCode":"                if (File.Exists(Path.Combine(pathTemp, \"Project.json\")))\n                {\n                    //Read as text.\n                    var json = File.ReadAllText(Path.Combine(pathTemp, \"Project.json\"));\n\n                    using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))\n                    {\n                        var ser = new DataContractJsonSerializer(typeof(ProjectInfo));\n                        var project = ser.ReadObject(ms) as ProjectInfo;\n\n                        list = project?.Frames;\n                    }\n                }\n                else\n                {\n                    if (File.Exists(Path.Combine(pathTemp, \"List.sb\")))\n                        throw new Exception(\"Project not compatible with this version\");\n\n                    throw new FileNotFoundException(\"Impossible to open project.\", \"List.sb\");\n                }\n\n                //Shows the ProgressBar\n                ShowProgress(LocalizationHelper.Get(\"S.Editor.ImportingFrames\"), list?.Count ?? 0);\n\n                var count = 0;\n                foreach (var frame in list ?? [])\n                {\n                    //Change the file path to the current one.\n                    frame.Path = Path.Combine(pathTemp, Path.GetFileName(frame.Path));\n\n                    count++;\n                    UpdateProgress(count);\n                }\n\n                return list;\n            }\n            catch (Exception ex)","sourceCodeStart":4097,"sourceCodeEnd":4133,"githubUrl":"https://github.com/NickeManarin/ScreenToGif/blob/a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd/ScreenToGif/Windows/Editor.xaml.cs#L4097-L4133","documentation":"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.","triggerScenarios":"ZipFile.ExtractToDirectory succeeds, but File.Exists(Project.json) and File.Exists(List.sb) both return false.","commonSituations":"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.","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."],"exampleFix":"// before\nthrow new FileNotFoundException(\"Impossible to open project.\", \"List.sb\");\n\n// after\nthrow 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\");","handlingStrategy":"validation","validationCode":"var entries = Directory.GetFiles(pathTemp);\nif (!entries.Any(f => Path.GetFileName(f).Equals(\"Project.json\", StringComparison.OrdinalIgnoreCase) ||\n                      Path.GetFileName(f).Equals(\"List.sb\", StringComparison.OrdinalIgnoreCase)))\n    // warn user: archive has no recognizable manifest","typeGuard":"static bool HasKnownManifest(string pathTemp) =>\n    Directory.GetFiles(pathTemp).Any(f =>\n        Path.GetFileName(f).Equals(\"Project.json\", StringComparison.OrdinalIgnoreCase) ||\n        Path.GetFileName(f).Equals(\"List.sb\", StringComparison.OrdinalIgnoreCase));","tryCatchPattern":"try { return ImportFromProject(source, pathTemp); }\ncatch (FileNotFoundException ex) when (ex.FileName == \"List.sb\" || ex.FileName == \"Project.json\")\n{ /* ask the user for an uncorrupted project file */ }","preventionTips":["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."],"tags":["project","import","corruption","file-not-found"],"backgroundTag":null,"analyzedSha":"a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd","analyzedAt":"2026-08-13T11:12:06.147Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}