Failed monolinker error on compile

I am using Unity iPhone pro and am using an external .dll compiled to the .NET 1.1

I have been using this DLL just fine, even on actual iPhone builds.

When I compile I get the following error

I had this problem before and I fixed it by changing changing the parameter order on the method stub. When I had MyMethod(MyEnum someEnum,BinaryReader reader) I would get a similar crash. When I changed the method that was in my external DLL to MyMethod(BinaryReader reader,MyEnum someEnum) it would compile without an issue. None of my methods are overloaded. Compiling worked fine for a while after this change but it has come back again.

I made a test project that also uses my DLL and haven’t been able to re-create the error. I have a pretty large codebase so its hard to track down what is causing the problem but the above issue is how I resolved it before.

Throughout development I am making changes to this external DLL.

This project is committed to an asset server. I have tried downloading the project to a new folder but I get the same compiler issue.

Is there a cache mono keeps of my .dll somewhere that I can try clearing?

The error is coming from Users/joe/iphone-clean/Editor/Mono/PostprocessBuildPlayer.cs:561

Is there some way to determine what script file is being processed at that point, if its a particular script and be able to report that in the error message?

Any input on what may be the cause of this error would be great =)

Hello,
please submit bug report with your project attached to it and drop me a private message with bug number.

In the process of making a sample application I was able to stop the crashing without changing any code.

Before posting I had tried restarting Unity iPhone and my Mac but that didn’t help.

I copied my entire VS 2003 solution to a new folder and compiled it.I then used the DLL generated by that project and the crashing stopped. I went back to my original project and generated a DLL from it again and it worked fine also. So in the process of restarting VS or using a new folder the issue was resolved. The bad DLL in question still causes the compiler to crash even though the dll works fine in the simulator.

Hi Mantas

I have the same exact problem - not trying to run any external dll but pure script.

I will PM you the support number once submitting is done

/Thomas

One thing to keep in mind is that Unity iPhone is .NET 1.1, different things are cut.
The simulator / editor is regular Unity, which is .NET 2.0 + parts of 3.0

Thomas issue was caused by simultaneous use of .NET sockets and micro mscorlib stripping setting. Currently micro mscorlib is not compatible with .NET sockets.

Failed running /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed” -l none -c link -x “/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml” -f “/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/LinkerDescriptors” -x “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/…/platform_native_link.xml” -x “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml” -d “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/CommonLib.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/Config2.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/LumenWorks.Framework.IO.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/Microsoft.QualityTools.Testing.Fakes.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/ProtoCmd.dll” -a “/Users/zhaoye/xlj_main/trunk/main/Temp/StagingArea/Data/Managed/MatrixWrapper.dll”

stdout:
Fatal error in Mono CIL Linker
System.Exception: Error processing method: ‘System.Void GUIWrapper::GetExternalStorageDirectory()’ in assembly: ‘MatrixWrapper.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve UnityEngine.AndroidJavaClass
at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in :0
at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in :0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in :0
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in :0
— End of inner exception stack trace —
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in :0
at Mono.Linker.Steps.MarkStep.Process () [0x00000] in :0
at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in :0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in :0
at Mono.Linker.Driver.Run () [0x00000] in :0
at Mono.Linker.Driver.RunDriver (Mono.Linker.Driver driver) [0x00000] in :0
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:66)
UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable1, String&, String&, String, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:192) UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:185)
UnityEditorInternal.AssemblyStripper:Strip(String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:136) UnityEditorInternal.AssemblyStripper:Strip(String[ ], String[ ], String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:121)
UnityEditorInternal.IL2CPPBuilder:RunAssemblyStripper(IEnumerable, String, String[ ], String[ ], String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:445)
UnityEditorInternal.IL2CPPBuilder:StripAssemblies(String[ ], String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:433)
UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:273)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditor.HostView:OnGUI()

@zzpzzp

I’ve answered this question on another thread where it was asked:

http://forum.unity3d.com/threads/please-help-for-il2cpp-problem.302670/#post-2321970

Please try to stick to posting a question only once that we we can keep things simpler on the forum. Thanks!