Issue while using HttpClient with Il2cpp builds
When I use System.Net.Http.HttpClient with Il2cpp build for android or ios I always get error for ParseQuery String but it works with mono
Error: called non-existent method System.Collections.Specialized.NameValueCollection System.Web.HttpUtility::ParseQueryString(System.String)
I though it was related to assemblies stripping, so I added a rule to preserve System.Web assembly
<assembly fullname="System.Web">
<type fullname="System.Web.HttpRequest" perserve="all"/>
</assembly>
But This didn't seem to work
Does anyone have an idea if it is a stripping issue or something related to System.Web dll itself? I appreciate your help
Answer by JoshPeterson · Aug 24, 2021 at 12:11 PM
It looks like the link.xml file you showed is preserving System.Web.HttpRequest, but the missing method is on System.Web.HttpUtility. Maybe try to add System.Web.HttpUtility to the link.xml file as well.
I tried adding it but got the same result
<assembly fullname="System.Web">
<type fullname="System.Web.HttpRequest" perserve="all"/>
<method signature="System.Collections.Specialized.NameValueCollection ParseQueryString(System.String)" />
</assembly>
maybe unity has its own version of System.Web
I don't believe that link.xml file will preserve the method you intend. Can you first attempt to keep all of HttpUtility:
<assembly fullname="System.Web">
<type fullname="System.Web.HttpRequest" perserve="all"/>
<type fullname="System.Web.HttpUtility" perserve="all"/>
</assembly>
I changed the link file, but I got the same error. I appreciate your help, but it looks like I have to try a different approach that doesn't require System.Web.
Your answer
Follow this Question
Related Questions
NotImplementedException: Unmanaged activation is not supported 0 Answers
black screen and froze UI in android AR app with scripting backend il2cpp build 0 Answers
[ASP.NET] [WEB API] Problem with HttpWebRequest.ContentType 0 Answers
UnityWebRequest and System Proxy 0 Answers
build with IL2CPP error unity 4.6.9 while making iOS build 1 Answer