Search Unity

Code stripping issues on android with System.Net.WebClient

Discussion in 'Android' started by crushforth, Feb 11, 2016.

  1. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    With code stripping disabled everything works perfectly. I've been slowly adding missing methods to the link.xml file all morning trying to get it to a stage when it works with code stripping set to 'Strip Assemblies'.

    The current error looks like this:

    Code (csharp):
    1.  
    2. WebException: Error: ConnectFailure
    3.     at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
    4.     at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
    5.     at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
    6.     at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0
    7. UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
    8. UIButtonMessage:Send()
    9.  

    This doesn't look like the same 'missing method exceptions' and null pointer exceptions I've been getting all day but the situation is resolved when stripping is disabled.

    I've been slowly building this link.xml file. What could I be missing? Also I'm not sure all of it is in the correct assemble sections.

    Code (csharp):
    1.  
    2. <linker>
    3.     <assemblyfullname="UnityEngine">
    4.         <typefullname="UnityEngine.TerrainCollider"preserve="all"/>
    5.        <typefullname="UnityEngine.FlareLayer"preserve="all"/>
    6.        <typefullname="UnityEngine.ParticleSystemRenderer"preserve="all"/>
    7.        <typefullname="UnityEngine.Avatar"preserve="all"/>
    8.        <typefullname="UnityEngine.TerrainData"preserve="all"/>
    9.     </assembly>
    10.  
    11.     <assemblyfullname="System">
    12.        <typefullname="System.ComponentModel.TypeDescriptor"preserve="all"/>
    13.        <typefullname="System.ComponentModel.TypeConverter"preserve="all"/>
    14.        <typefullname="System.ComponentModel.StringConverter"preserve="all"/>
    15.        <typefullname="System.ComponentModel.BooleanConverter"preserve="all"/>
    16.        <typefullname="System.ComponentModel.EnumConverter"preserve="all"/>
    17.        <typefullname="System.ComponentModel.Int64Converter"preserve="all"/>
    18.        <typefullname="System.ComponentModel.Int32Converter"preserve="all"/>
    19.        <typefullname="System.ComponentModel.Int16Converter"preserve="all"/>
    20.        <typefullname="System.ComponentModel.ArrayConverter"preserve="all"/>
    21.        <typefullname="System.ComponentModel.CollectionConverter"preserve="all"/>
    22.        <typefullname="System.ComponentModel.DecimalConverter"preserve="all"/>
    23.        <typefullname="System.ComponentModel.SingleConverter"preserve="all"/>
    24.        <typefullname="System.ComponentModel.DoubleConverter"preserve="all"/>
    25.  
    26.        <typefullname="System.Net.Configuration.WebRequestModuleElementCollection"preserve="all"/>
    27.        <typefullname="System.Net.Configuration.WebRequestModuleElement"preserve="all"/>
    28.        <typefullname="System.Net.Configuration.WebRequestModulesSection"preserve="all"/>
    29.        <typefullname="System.Net.Configuration.ConnectionManagementElementCollection"preserve="all"/>
    30.        <typefullname="System.Net.Configuration.ConnectionManagementSection"preserve="all"/>
    31.        <typefullname="System.Net.Configuration.DefaultProxySection"preserve="all"/>
    32.        <typefullname="System.Net.Configuration.HttpWebRequestElement"preserve="all"/>
    33.        <typefullname="System.Net.Configuration.Ipv6Element"preserve="all"/>
    34.        <typefullname="System.Net.Configuration.NetSectionGroup"preserve="all"/>
    35.        <typefullname="System.Net.Configuration.PerformanceCountersElement"preserve="all"/>
    36.        <typefullname="System.Net.Configuration.ProxyElement"preserve="all"/>
    37.        <typefullname="System.Net.Configuration.ServicePointManagerElement"preserve="all"/>
    38.        <typefullname="System.Net.Configuration.SettingsSection"preserve="all"/>
    39.        <typefullname="System.Net.Configuration.SocketElement"preserve="all"/>
    40.        <typefullname="System.Net.Configuration.WebRequestModuleHandler"preserve="all"/>
    41.  
    42.        <typefullname="System.Net.HttpRequestCreator"preserve="all"/>
    43.        <typefullname="System.Net.FileWebRequestCreator"preserve="all"/>
    44.        <typefullname="System.Net.FtpRequestCreator"preserve="all"/>
    45.        <typefullname="System.Net.*"preserve="all"/>
    46.  
    47.  
    48.        <typefullname="System.UriTypeConverter"preserve="all"/>
    49.        <typefullname="System.*"preserve="all"/>
    50.        <typefullname="System.Net.WebClient.*"preserve="all"/>
    51.  
    52.        <typefullname="System.Uri"preserve="all"/>
    53.        <typefullname="System.Net.HttpWebRequest"preserve="all"/>
    54.        <typefullname="System.Net.WebClient"preserve="all"/>
    55.        <typefullname="System.IAsyncResult"preserve="all"/>
    56.        <typefullname="System.Net.WebAsyncResult"preserve="all"/>
    57.     </assembly>
    58.  
    59.     <assemblyfullname="System.Configuration">
    60.        <typefullname="System.Configuration.ExeConfigurationHost"preserve="all"/>
    61.        <typefullname="System.Configuration.ClientConfigurationSystem "preserve="all"/>
    62.     </assembly>
    63.  
    64.     <assemblyfullname="System.Runtime.Serialization">
    65.        <typefullname="System.Runtime.Serialization.SerializationInfo"preserve="all"/>
    66.        <typefullname="System.Runtime.Serialization.StreamingContext"preserve="all"/>
    67.        </assembly>
    68.     </linker>
    69.  
     
  2. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    I managed to solve issue using a method described here:

    http://answers.unity3d.com/questions/800287/using-httpwebrequest-when-stripping-assemblies.html

    in particular the following:

    Code (csharp):
    1.  
    2. <linker>
    3. <assembly fullname="System">
    4. <namespace fullname="System.Net"preserve="all"/>
    5. <namespace fullname="System.Net.Configuration"preserve="all"/>
    6. <namespace fullname="System.ComponentModel"preserve="all"/>
    7. <namespace fullname="System.Runtime.ConstrainedExecution"preserve="all"/>
    8. <namespace fullname="System.Runtime.InteropServices"preserve="all"/>
    9. <namespace fullname="System.Runtime.Serialization"preserve="all"/>
    10. <namespace fullname="System.Configuration"preserve="all"/>
    11. </assembly>
    12. <assembly fullname="mscorlib">
    13. <namespace fullname="System.Security.Cryptography"preserve="all"/>
    14. </assembly>
    15. <assembly fullname="Mono.Security">
    16. <namespace fullname="Mono.Security.Protocol.Tls"preserve="all"/>
    17. <namespace fullname="Mono.Security.X509"preserve="all"/>
    18. </assembly>
    19. </linker>
    20.  
     
    deus0 likes this.