It's my link.xml info: Code (csharp): <linker> <assembly fullname="System"> <type fullname="System.Net" preserve="all"/> <type fullname="System.Threading" preserve="all"/> <type fullname="System.Net.Sockets" preserve="all"/> <type fullname="System.IO" preserve="all"/> <type fullname="System.Text" preserve="all"/> <type fullname="System.Collections" preserve="all"/> <type fullname="System.Collections.Generic" preserve="all"/> <type fullname="System.Net.WebRequest" preserve="all"/> <type fullname="System.Configuration.ExeConfigurationHost" preserve="all"/> <type fullname="System.Configuration" preserve="all"/> </assembly> </linker> It's the problem(for xcode throw): Code (csharp): Loading /var/mobile/Applications/5A35737D-ECB3-4C4E-9219-6E18D5D87D63/COD0506t2.app/Data/Managed/System.Data.dll into Unity Child Domain - Completed reload, in 0.171 seconds -> applicationDidBecomeActive() Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.WebRequest ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Configuration.ExeConfigurationHost'. at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 at System.Configuration.InternalConfigurationSystem.Init (System.Type typeConfigHost, System.Object[] hostInitParams) [0x00000] in <filename unknown>:0 at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0 at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filenameunknown>:0 at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 at System.Net.WebRequest..cctor () [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at Net.Http.HttpUtil.GetHttp (System.String httpUrl) [0x00000] in <filename unknown>:0 at Net.NetManager.ExecuteGetHttp () [0x00000] in <filename unknown>:0 Clark (Filename: /Applications/buildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43) -> force accelerometer registration The game I'm working on using several classes from the System.Net.Sockets package. If I run it on a normal build it works perfectly, but if I try to strip it using either StrippingLevel.StripAssemblies or StrippingLevel.StripByteCode stripping levels, it crashes with a*exception (above...). But, why? Additional Information: 1, I have implemented Http using System.Net.Sockets. 2, When I use my link.xml, the size of System.dll is increased (259kb). 3, When I only use [StrippingLevel.StripByteCode], the size of System.dll is small (252kb). 4, When I disable the [strip function], the size of System.dll is biggest (1.7m).
If I want to ignore all classes of System.dll , How can I do? Because, I only need to strip my Assembly-CSharp.dll en... Is this right? Code (csharp): <linker> <assembly fullname="System"> <type fullname="System.*" preserve="all"/> </assembly> <assembly fullname="mscorlib"> <namespace fullname="System.*" preserve="all"/> </assembly> </linker>
1. Discover the name of the assembly for excluding Build project for windows (or just looking for any dlls in project) Got .NET SomeAssemblyBrowser (ILspy or something like this) Open in SomeAssemblyBrowser suspected dll libraries (BuildFolder\Managed, BuildFolder\Plugins etc) Figure out assembly name by searching for desired namespace For example you found SomeAssemblyName and SomeNamespaceName within it. 2. Make the file Assets\link.xml: Code (csharp): <linker> <assembly fullname="SomeAssemblyName"> <namespace fullname="SomeNamespaceName" preserve="all"/> </assembly> </linker> 3. Build project for iOS with this file, set strip level different values and verify that the corresponding BuildFolder/Libraries/SomeLibraryName.dll.s size is changing (also "Other/SystemExecutableAndDll" size in Profiler.Memory.Detailed Take Sample)
I encountered the same problem when used HttpWebRequest. Following link.xml helps: <linker> <assembly fullname="System"> <type fullname="System.Net.HttpWebRequest" preserve="all"/> <type fullname="System.Net.WebResponse" preserve="all"/> <type fullname="System.Net.HttpRequestCreator" preserve="all"/> </assembly> </linker> But I don't know what's the reason and how to find the corrected type name, anybody can help?
Okay, a little help for those searching for some instructions on how this works. This is based on trial and error. "type" can be either a class name (with full namespace) or just a namespace and every class within that namespace will be excluded. Child namespaces will not be excluded just by adding the parent namespace. In order to exclude namespaces recursively, use * Code (csharp): <linker> <assembly fullname="MyAssemblyName"> // the name of the assembly <type fullname="MyNamespace" preserve="all"/> // excludes all classes that are direct children of MyNamespace <type fullname="MyNamespace.*" preserve="all"/> // excludes all namespaces and classes recursively under MyNamespace <type fullname="MyNamespace*" preserve="all"/> // excludes all namespaces and classes recursively under MyNamespace. Would also exclude the namespace MyNamespaceABC <type fullname="My*" preserve="all"/> // excludes all namespaces and classes that start with My and all children of those namespaces <type fullname="*" preserve="all"/> // excludes all namespaces and classes in the assembly </assembly> </linker> Essentially, it seems to be just a simple string comparison. Also, using the namespace element also works. I haven't tested this but I assume it excludes everything within that namespace. Not sure about child namespaces within the parent. Code (csharp): <linker> <assembly fullname="MyAssemblyName"> <namespace fullname="MyNamespace" preserve="all"/> </assembly> </linker>