Skip to content
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

Trimming unused code causes the exception - Response could not be deserialized to JSON #827

Closed
KB4MDD opened this issue May 29, 2024 · 4 comments

Comments

@KB4MDD
Copy link

KB4MDD commented May 29, 2024

I am compiling my .NET 8 application for linux-arm, I have enabled the produce single file and trim unused code options. Flurl raises the exception "Response could not be deserialized to JSON". When I uncheck the "trim unused code" option, there is no exception.

It is clear that the compiler and linker are discarding something that Flurl needs to deserialize the JSON data. This may be addressed by changes asked for in #777.

I am moving my application from .NET 6 to .NET 8. I did not have an issue with .NET 6.

@KB4MDD KB4MDD added the bug label May 29, 2024
@tranb3r
Copy link
Contributor

tranb3r commented May 29, 2024

Did you try setting JsonSerializerIsReflectionEnabledByDefault to false ?

@KB4MDD
Copy link
Author

KB4MDD commented May 29, 2024

I tried setting that property to false and it still fails. I also tried setting to true and it still fails.

@tmenier
Copy link
Owner

tmenier commented Jun 2, 2024

Thanks for reporting. I'm not very well equipped to troubleshoot support for less-common platforms, so I try and lean on the community to help with things like this.

@KB4MDD
Copy link
Author

KB4MDD commented Jun 3, 2024

I have worked around the problem using the source generation capabilities in system.text.json.

It would be nice to have Issue #777 implemented so that a context could be passed to Flurl.

I am closing this issue.

@KB4MDD KB4MDD closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants