{"record":{"id":"c488cdb78011b3ee","repo":"unoplatform/uno","slug":"value","errorCode":null,"errorMessage":"value","messagePattern":"value","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/AddIns/Uno.UI.Lottie/System.Json/JsonValue.cs","lineNumber":520,"sourceCode":"\n\t\t\treturn (DateTimeOffset)((JsonPrimitive)value).Value;\n\t\t}\n\n\t\tpublic static implicit operator TimeSpan(JsonValue value)\n\t\t{\n\t\t\tif (value == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException(nameof(value));\n\t\t\t}\n\n\t\t\treturn (TimeSpan)((JsonPrimitive)value).Value;\n\t\t}\n\n\t\tpublic static implicit operator Guid(JsonValue value)\n\t\t{\n\t\t\tif (value == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException(nameof(value));\n\t\t\t}\n\n\t\t\treturn (Guid)((JsonPrimitive)value).Value;\n\t\t}\n\n\t\tpublic static implicit operator Uri(JsonValue value)\n\t\t{\n\t\t\tif (value == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException(nameof(value));\n\t\t\t}\n\n\t\t\treturn (Uri)((JsonPrimitive)value).Value;\n\t\t}\n\t}\n}\n","sourceCodeStart":502,"sourceCodeEnd":537,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/AddIns/Uno.UI.Lottie/System.Json/JsonValue.cs#L502-L537","documentation":"ArgumentNullException thrown by the implicit conversion operator from JsonValue to Guid when the passed JsonValue is null. System.Json (vendored in Uno.UI.Lottie) defines implicit operators for many CLR types; each guards against a null JsonValue by throwing ArgumentNullException(nameof(value)).","triggerScenarios":"Casting/null-coercing a JsonValue to Guid via the implicit operator, e.g. Guid g = someJsonValueNode; where the node is null — common when a JSON property is missing and the lookup returned null and was directly assigned.","commonSituations":"Indexing into a JsonObject with a key that doesn't exist (returns null) and implicitly converting to Guid; deserializing a schema where a Guid field is optional but the code assumes presence.","solutions":["Null-check the JsonValue before implicit conversion: if (node is JsonPrimitive prim) guid = prim;","Use JsonObject.TryGetValue / ContainsKey to verify the key exists before access.","Use explicit (Guid?) handling or JsonValue.Parse-based deserialization that respects optional fields.","Validate the JSON schema includes the expected Guid field before conversion."],"exampleFix":"// before\nGuid id = obj[\"id\"]; // throws if obj[\"id\"] is null\n\n// after\nGuid id = obj[\"id\"] is JsonValue v ? (Guid)v : Guid.Empty;","handlingStrategy":"type-guard","validationCode":"// Check the node exists and is a primitive before Guid conversion\nif (obj.TryGetValue(\"id\", out var idNode) && idNode is JsonValue)\n    guid = (Guid)idNode;\nelse\n    guid = Guid.Empty;","typeGuard":"bool IsConvertibleToGuid(JsonValue? v)\n    => v is JsonPrimitive p && p.JsonType == JsonType.String && Guid.TryParse((string)p.Value, out _);","tryCatchPattern":null,"preventionTips":["Null-check JsonValue before implicit conversions.","Use TryGetValue to confirm keys exist.","Treat Guid fields as optional until proven present."],"tags":["system-json","json","nullable","guid","uno-platform"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}