-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] [L] Stop using reflection to deserialize JSON #2343
Comments
Would it make sense to move to System.Text.JSon? |
We can't move to System.Text because:
|
@pmaytak - are you interested in taking a look at this? It has a perf component to it, so it would be great to understand if we will make some improvement (or at least not regress perf). |
Related issue #2231 (so it's easier to find). |
Remaining work;
|
As discussed with @bgavrilMS, removing code that uses reflection is very impractical. The recommendation then is to use Link XML as a solution to enable MSAL to work in Unity projects. This is one of the solutions to this known behavior that is described in Unity Managed code stripping docs. I also updated our wiki with more information. PR #2403 shows the attempt at serializing without reflection and the complexities that arise. Changes to
|
@pmaytak : there was already an FAQ for this issue: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Troubleshooting-unity |
The only thing that looks difficult and error prone from the PR code is knowing whether the conversions need In general making implicit code explicit will reduce bugs in the medium term as it gives more precise specification.
What is the difficulty of HttpResponse?
Replacing serialization code should be fine for now (this issue). In the future linker (currently living in mono/linker) and AOT analysis (currently living in dotnet/runtimelab) will identify reflection. |
Reflection is causing tons of problems on the more exotic runtimes such as ARM and Unity. It's also a perf impact, because deserializing JSON via reflection is slow (it discovers the JSON 2 obj mappings first and then it deserialize it).
We should explore eliminating the reflection step. It should be possible to read the JSON in memory and extract each field individually. Each object that supports deserialization would need to implement a simple interface
The text was updated successfully, but these errors were encountered: