{"record":{"id":"3d8b8e1f8c3168d3","repo":"ElectronNET/Electron.NET","slug":"unexpected-end-while-reading-property-value","errorCode":null,"errorMessage":"Unexpected end while reading property value.","messagePattern":"Unexpected end while reading property value\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs","lineNumber":37,"sourceCode":"                case JsonTokenType.StartObject:\n\n                    var obj = new Dictionary<string, object>();\n                    while (r.Read())\n                    {\n                        if (r.TokenType == JsonTokenType.EndObject)\n                        {\n                            return obj;\n                        }\n\n                        if (r.TokenType != JsonTokenType.PropertyName)\n                        {\n                            throw new JsonException(\"Expected property name.\");\n                        }\n\n                        string name = r.GetString()!;\n                        if (!r.Read())\n                        {\n                            throw new JsonException(\"Unexpected end while reading property value.\");\n                        }\n\n                        obj[name] = ReadValue(ref r);\n                    }\n\n                    throw new JsonException(\"Unexpected end while reading object.\");\n\n                case JsonTokenType.StartArray:\n\n                    var list = new List<object>();\n                    while (r.Read())\n                    {\n                        if (r.TokenType == JsonTokenType.EndArray)\n                        {\n                            return list;\n                        }\n\n                        list.Add(ReadValue(ref r));","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/ElectronNET/Electron.NET/blob/87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2/src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs#L19-L55","documentation":"In JsonToBoxedPrimitivesConverter.ReadValue, after successfully reading a property name inside an object the converter calls r.Read() to advance to the value; if the reader reaches the end of the JSON first (returns false), it throws this JsonException. It means the JSON ended in the middle of an object property.","triggerScenarios":"A JSON object truncated right after a property name, e.g. '{ \"width\":' or '{ \"width\" }' with no value; IPC payloads cut off mid-transmission.","commonSituations":"Network/IPC message truncation; string truncation from fixed-size buffers; incomplete serialization before the payload was sent.","solutions":["Verify the JSON payload is complete (balanced braces/quotes) before sending","Log the raw payload length and content on error to confirm truncation","Increase buffer/pipe size limits if large payloads get truncated","Validate with JSON.parse on the sending side"],"exampleFix":"// before\n// sending '{ \"width\":' (truncated)\n// after\n// sending complete JSON: '{ \"width\": 800 }'\nJSON.stringify(options); // ensure the full string is transmitted","handlingStrategy":"try-catch","validationCode":"// sender: confirm complete transmission\nconst json = JSON.stringify(msg);\nsocket.write(json, () => console.assert(JSON.parse(json) !== undefined));","typeGuard":null,"tryCatchPattern":"try\n{\n    var value = JsonSerializer.Deserialize<object>(json, ElectronJson.Options);\n}\ncatch (JsonException ex)\n{\n    logger.LogWarning(ex, \"Truncated JSON received ({Len} bytes): {Raw}\", json?.Length, json);\n}","preventionTips":["Check IPC/pipe message framing so payloads aren't cut off","Avoid fixed-size buffers for JSON transport","Validate payload completeness (balanced quotes/braces) before sending"],"tags":["json","parsing","truncated"],"backgroundTag":"json-parse-error","analyzedSha":"87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2","analyzedAt":"2026-09-14T03:09:47.608Z","contentChangedAt":"2026-09-14T03:09:47.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}