Using HttpWebRequest when Stripping Assemblies

Hi,

I have a problem similar to this one: http://answers.unity3d.com/answers/612479/post.html.

While stripping assemblies (first level of stripping) our app cannot successfully complete purchases and returns this:

WebException: Error: ConnectFailure

System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetRequestStream()
OurScript+c__Iterator53.MoveNext()

The important part is the stream stuff. Here is our link file:

<linker>   
  <assembly fullname="System">
    <type fullname="System.Net.HttpRequestCreator" preserve="all" />
    <type fullname="System.IAsyncResult" preserve="all" />
    <type fullname="System.ComponentModel.StringConverter" preserve="all" />
    <type fullname="System.ComponentModel.SingleConverter" preserve="all" />
    <type fullname="System.ComponentModel.BooleanConverter" preserve="all" />
    <type fullname="System.ComponentModel.DecimalConverter" preserve="all" />
    <type fullname="System.ComponentModel.DoubleConverter" preserve="all" />
    <type fullname="System.ComponentModel.ArrayConverter" preserve="all" />
    <type fullname="System.ComponentModel.CollectionConverter" preserve="all" />
    <type fullname="System.ComponentModel.EnumConverter" preserve="all" />
    <type fullname="System.ComponentModel.Int32Converter" preserve="all" />
    <type fullname="System.ComponentModel.Int64Converter" preserve="all" />   
  </assembly>   
  <assembly fullname="mscorlib">
    <namespace fullname="System.Security.Cryptography" preserve="all" />
    <type fullname="System.Net.WebResponse" preserve="all" />
    <type fullname="System.Net.HttpWebResponse" preserve="all" />   
  </assembly> 
</linker>

I cannot track down the right namespace / type for GetRequestStream or EndGetRequestStream for the life of me. MSDN provides some information, but as you can see from the link file, I’ve already put what I thought would allow this System.Net.Http functionality.

My question is, for you .NET guru’s and Link.xml extraordinaires, what the hell kind of type / namespace am I suppose to stop from being stripped if not HttpWebResponse!

I found that the key was to include a few things from Mono.Security. Now I have System.Net.HttpWebRequest with HTTPS working on device (iOS).

Here’s my link.xml:

<linker>
  <assembly fullname="System">
    <namespace fullname="System.Net" preserve="all"/>
    <namespace fullname="System.Net.Configuration" preserve="all"/>
    <namespace fullname="System.ComponentModel" preserve="all"/>
    <namespace fullname="System.Runtime.ConstrainedExecution" preserve="all"/>
    <namespace fullname="System.Runtime.InteropServices" preserve="all"/>
    <namespace fullname="System.Runtime.Serialization" preserve="all"/>
    <namespace fullname="System.Configuration" preserve="all"/>
  </assembly>
  <assembly fullname="mscorlib">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
  </assembly>
  <assembly fullname="Mono.Security">
    <namespace fullname="Mono.Security.Protocol.Tls" preserve="all"/>
    <namespace fullname="Mono.Security.X509" preserve="all"/>
  </assembly>
</linker>