Search Issue Tracker
By Design
Votes
1
Found in
2020.3.45f1
2023.1.0b4
2023.2.0a2
Issue ID
UUM-26848
Regression
Yes
Newtonsoft Json doesn't correctly serialize classes inside the Packages folder when in UWP and WebGL Builds
How to reproduce:
# Open the attached project "REMOVE-DATACONTRACT.zip"
# Build the project for UWP
Expected results: "Dictionary Count: 3" is displayed
Actual results: "Dictionary Count: 0" is displayed
Reproducible with: 2020.3.45f1, 2023.1.0a26, 2023.1.0b4, 2023.2.0a2
Not reproducible with: 2021.3.18f1, 2022.2.7f1, 2023.1.0a25
Reproducible on: Windows 10
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on ResizeScriptingList<ScriptingObjectPtr> when passing an undeclared variable to the results parameter for GameObject.FindGameObjectsWithTag
- [Android] "Screen.safeArea.y" always returns values outside of the Safe Area when the device is in Portrait orientation
- Frame spike due to many TreeRenderer.TreeUpdated calls when repositioning terrains in large Scenes
- Crash on GameObject::RemoveComponentFromGameObjectInternal when reparenting Text GameObjects
- [IL2CPP-GarbageCollector] Changing GCMode might permanently disable GC in a multithreaded context
Resolution Note:
This is not a bug. This code is doing reflection based serialization. Managed Code stripping cannot track reflection based serialization. The package code must be annotated.
The `[RequiredMember]` attribute is useful here. The following fixes this code.
```
public class AuthorizationCodeRequest
{
[DataMember(Name = "response_type", IsRequired = true)]
public string responseType
{
[RequiredMember]
get
{ return "code"; }
}
[DataMember(Name = "client_id", IsRequired = true)]
public string clientId
{ [RequiredMember] get; [RequiredMember] set; }
[DataMember(Name = "redirect_uri")]
public string redirectUri { [RequiredMember] get; [RequiredMember] set; }
}
```