Closed muveso closed 2 years ago
Hi! Which .NET profile are you using in Unity?
@Pathoschild I am using .NET 4.x APIs.
@muveso The error is happening in the lower-level .NET HttpClient
due to part of .NET Framework being unimplemented. I don't use Unity myself, but this bit from Using .NET 4.x in Unity: IL2CPP Considerations might be relevant:
[...] Unity will attempt to strip out unused code during the IL2CPP export process. While this typically isn't an issue, with libraries that use Reflection, it can accidentally strip out properties or methods that will be called at run time that can't be determined at export time. To fix these issues, add a link.xml file to your project which contains a list of assemblies and namespaces to not run the stripping process against. For full details, please see Unity's docs on bytecode stripping.
And from the linked Unity docs:
Serialization AOT platforms might encounter issues with serialization and deserialization because of the use of reflection. If a type or method is only used via reflection as part of serialization or deserialization, the AOT compiler cannot detect that it needs to generate the code needs for the type or method.
You can try temporarily turning off code stripping to see if that fixes the error. If it does, you can add a link.xml
which lists the specific types that are needed.
Hi,
I want to use FluentHttpClient in Unity - Android. it works with mono builds but doesn't work with il2cpp. I would be very grateful if you could help me resolve this issue. because there is no unity rest client service that uses async infrastructure.