{"record":{"id":"f85c6bb5a62267ee","repo":"JosefNemec/Playnite","slug":"uknown-releasedate-string-format","errorCode":null,"errorMessage":"Uknown ReleaseDate string format.","messagePattern":"Uknown ReleaseDate string format\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"source/PlayniteSDK/Models/ReleaseDate.cs","lineNumber":269,"sourceCode":"                throw new ArgumentNullException(nameof(stringDate));\r\n            }\r\n\r\n            var split = stringDate.Split(serSplitter);\r\n            if (split.Length == 3)\r\n            {\r\n                return new ReleaseDate(int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]));\r\n            }\r\n            else if (split.Length == 2)\r\n            {\r\n                return new ReleaseDate(int.Parse(split[0]), int.Parse(split[1]));\r\n            }\r\n            else if (split.Length == 1)\r\n            {\r\n                return new ReleaseDate(int.Parse(split[0]));\r\n            }\r\n            else\r\n            {\r\n                throw new NotSupportedException(\"Uknown ReleaseDate string format.\");\r\n            }\r\n        }\r\n\r\n        /// <inheritdoc/>\r\n        public override string ToString()\r\n        {\r\n            if (Day != null)\r\n            {\r\n                return Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);\r\n            }\r\n            else if (Month != null)\r\n            {\r\n                return Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.YearMonthPattern);\r\n            }\r\n            else\r\n            {\r\n                return Year.ToString();\r\n            }\r","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/PlayniteSDK/Models/ReleaseDate.cs#L251-L287","documentation":"Thrown by ReleaseDate.Deserialize when the input string splits on '-' into more than 3 segments. Valid serialized forms are 'yyyy', 'yyyy-MM', 'yyyy-MM-dd'; anything with 4+ dash-separated parts (or an empty leading/trailing dash producing extra segments) is rejected as an unknown format.","triggerScenarios":"ReleaseDate.Deserialize(stringDate) is called; stringDate.Split('-') yields Length > 3 (e.g. '2020-01-02-03', '-2020', '2020--01', or '2020-01-02-extra'). The else branch at line 267 throws NotSupportedException.","commonSituations":"Manual edit of a serialized game release date field, a metadata import produced a malformed value, a full ISO timestamp ('2020-01-02T00-00-00') landed in the field, or a leading/trailing/double dash inflated the segment count.","solutions":["Normalize the input to 'yyyy', 'yyyy-MM', or 'yyyy-MM-dd' before calling Deserialize.","If a full date/time string is possible, parse it to DateTime first and construct ReleaseDate via the DateTime constructor overload.","Strip leading/trailing dashes and collapse repeated separators.","Wrap Deserialize in try/catch (NotSupportedException / FormatException from int.Parse) when ingesting untrusted metadata."],"exampleFix":"// before\nvar d = ReleaseDate.Deserialize(\"2020-01-02-00-00\"); // throws\n\n// after\nif (DateTime.TryParse(raw, out var dt))\n    date = new ReleaseDate(dt);\nelse if (ReleaseDate.TryParse(raw, out date)) { /* ok */ }\nelse date = ReleaseDate.Empty;","handlingStrategy":"try-catch","validationCode":"// Prefer TryParse where available; otherwise validate segment count:\nvar parts = stringDate.Split('-');\nif (parts.Length < 1 || parts.Length > 3 || parts.Any(p => !int.TryParse(p, out _)))\n    throw new FormatException($\"Invalid ReleaseDate '{stringDate}'.\");\nreturn ReleaseDate.Deserialize(stringDate);","typeGuard":"static bool IsValidReleaseDateString(string s)\n{\n    if (string.IsNullOrEmpty(s)) return false;\n    var p = s.Split('-');\n    return p.Length >= 1 && p.Length <= 3 && p.All(x => int.TryParse(x, out _));\n}","tryCatchPattern":"ReleaseDate date;\ntry { date = ReleaseDate.Deserialize(raw); }\ncatch (NotSupportedException) { date = ReleaseDate.Empty; } // or log + skip record\n// or prefer: ReleaseDate.TryParse(raw, out date)","preventionTips":["Use ReleaseDate.TryParse for untrusted input rather than Deserialize.","Normalize full date/time strings to DateTime before constructing ReleaseDate.","Validate metadata imports and discard/clean malformed release-date fields."],"tags":["sdk","datetime","serialization","validation","playnite"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}