Skip to content

[Correctness] JsonServiceSerializer/XmlServiceSerializer — Deserialize does not catch deserialization exceptions #680

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

Files:

  • src/Servy.Core/Services/JsonServiceSerializer.cs
  • src/Servy.Core/Services/XmlServiceSerializer.cs

Description:
Deserialize() does not catch JsonException/XmlException from the underlying deserializer. The interface contract does not document that callers must handle deserialization exceptions. This is inconsistent: JsonServiceValidator.TryValidate wraps the same call in try/catch, but the serializer does not.

Suggested fix:
Either catch and return null (matching the "returns null on failure" pattern used elsewhere), or document in the interface that callers must handle deserialization exceptions.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions