Skip to content

[Serialization] JsonSerializerOptions is not being respected #2845

Description

@erikvilima

Current behavior

Even when explicitly setting JsonSerializerOptions with ReadCommentHandling = JsonCommentHandling.Skip, deserializing a JSON that contains comments throws an exception saying that / is an invalid start of a property name.

Expected behavior

The provided JsonSerializerOptions should respected and skip comments in the JSON when ReadCommentHandling is set to Skip.

How to reproduce it (as minimally and precisely as possible)

  1. Create a minimal Uno app with Serialization
  2. Use serializer.FromString<T>(json) with JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip }.
  3. Pass a JSON string or file that contains comments (e.g., // this is a comment).
  4. Observe that an exception is thrown despite the ReadCommentHandling setting.

You can find a minimal repro project attached.

serialization.zip

Environment

"Uno.Sdk": "6.0.146"
"Uno.Sdk": "6.2.0-dev.16"

Affected platform(s): I have only tested Skia, WinAppSdk and WASM, but I assume it occurs everywhere.

  • iOS
  • macOS (AppKit)
  • Mac Catalyst
  • Android
  • WebAssembly
  • Windows
  • Desktop
  • Build tasks

Visual Studio:

  • 2019 (version: )
  • 2022 (version: 17.14.5 )
  • Visual Studio Code (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions