Announcement

Collapse
No announcement yet.

JsonConvert.DeserializeObject [External]

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    JsonConvert.DeserializeObject [External]

    Hello! Here is a bug on deserializing. If property's type is a Class with External attribute, bridge crashes.
    The way to fix is not to include properties of External types into memberlist, so that Bridge.Reflection.getMembers wont contain them.
    Here is a sample test.
    https://deck.net/652a7ea57acfd61f1f9cbac4b3c46084

    The way of workaround is the add [Reflectable(false)] on the property ( JsonIgnore attribute doesn't go)

    Thank you!

    #2
    The deserialization is failing because the class is marked as [External] and the class is not provided elsewhere at runtime. Once you mark as [External], it's up to the developer to ensure that class information is available at runtime. I could be missing something, but from my perspective, the Deck you provided is the expected result and would not be considered a defect.

    You could replace the [External] attribute with the [Virtual] attribute.

    https://github.com/bridgedotnet/Brid...erence#virtual

    https://deck.net/7e19c5c277e319070c18353831c9b265

    Hope this helps.

    Comment


      #3
      The [JsonIgnore] attribute applies only during serialization and would not affect deserialization, which is why in this scenario the exception is still thrown with (or without) the attribute.

      https://www.newtonsoft.com/json/help...eAttribute.htm

      Hope this helps.

      Comment

      Working...
      X