UnityException: Failed assemblies stripper:

Help !!!

I do not understand what happened !!!, I do not see what I did wrong ???

Suddenly I cannot build my project anymore ! it seem it is missing “get_ContainsGenericParameters()”
When building for iPhone I get this error on the console :

UnityException: Failed assemblies stripper: /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/mono "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe" -l none -c link -a "Assembly-CSharp-firstpass.dll" -a "Assembly-CSharp.dll" -a "Assembly-UnityScript.dll" -out output -x "/Applications/Unity/Unity.app/Contents/BuildTargetTools/iPhonePlayer/link.xml" -d "Temp/StagingArea/Data/Managed" -x "tmplink.xml" current dir : Temp/StagingArea/Data/Managed std=  err= 
Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Boolean System.Type::get_ContainsGenericParameters()
  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.Process () [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at UnusedBytecodeStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
 
 output: 
 result file exists: False
UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultFile)
UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[] input, UnityEditor.RuntimeClassRegistry usedClasses)
UnityEditor.HostView:OnGUI()

This has been reported as a bug (possibly by you) within the last few days but there is no resolution as yet.

YEs Andeeee I made a bug report : (Case 380304)

I have continued to investigate yesterday late.

  1. when I have no stripping, the bug disappears but it crashes during execution.

  2. Continuing to investigate, then, in one of my scripts, I had the following :

static var script ;

function Start() {
    scoreObj = GameObject.Find("ScoreGUI");
    script = scoreObj.GetComponent("ScoreManager");
}

No problem in the editor.

then, I changed the declaration to :

static var script : ScoreManager;

And I do not encounter the bug anymore, and I can build for iPhone with micro mscorelib.

Hope it helps.

Is there any resolution on this bug? I am seeing the same problem.

Unity’s Fogbugz doesn’t have a case number 380304. Is this bug listed under another case number?

I am also getting this bug. I have changed all of my static variables so that they are no longer dynamic datatypes. Is there any fix or is there any other issue that could cause this? I did get it to run by using stripping assemblies, but it crashed eventually.

I just wanted to add that this bug on my end was worked out. I did it by avoiding any dynamic data types, essentially adding #pragma strict at the top of all of my .js scripts. This was a bit of a hassel, but I tried everything I could find. This ended up helping because I moved away from the more expensive .net data types where and only kept the ones that were absolutely necessary. This was kind of my last resort though. I also changed the name of the build as a whole in the player settings. I’m not sure which of those two things fixed this problem, but I’m not getting it anymore.

also just in case you are wondering to force types in .js you add " as [ComponentType]"

I am seeing this bug now too.

Using C#
Unity 3.4.2f3

UnityException: Failed assemblies stripper: /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/mono "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe" -l none -c link -a "Assembly-CSharp-firstpass.dll" -a "Assembly-CSharp.dll" -a "Assembly-UnityScript.dll" -a "LitJson.dll" -a "relasphere-ar.dll" -out output -x "/Applications/Unity/Unity.app/Contents/BuildTargetTools/iPhonePlayer/link.xml" -d "Temp/StagingArea/Data/Managed" -x "tmplink.xml" current dir : Temp/StagingArea/Data/Managed
 result file exists: False
stdout: 
stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.IO.FileInfo[] System.IO.DirectoryInfo::GetFiles(System.String,System.IO.SearchOption)  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.Process () [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0   at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0   at UnusedBytecodeStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultFile)
UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[] input, UnityEditor.RuntimeClassRegistry usedClasses)
UnityEditor.HostView:OnGUI()
Error building Player: Building player scripts failed.
UnityEditor.HostView:OnGUI()
Exception: Error building Player: Building player scripts failed.
UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions)
UnityEditor.BuildPlayerWindow.GUIBuildButtons (Boolean enableBuildButton, Boolean enableBuildAndRunButton, Boolean canInstallInBuildFolder)
UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings ()
UnityEditor.BuildPlayerWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj)
UnityEditor.HostView.Invoke (System.String methodName)
UnityEditor.HostView.OnGUI ()

I got this problem too. Resolved it.
Essentially, this only happens when you enable Byte Stripping AND if you are using certain external dlls.

In my case it was the aperture dll from the Aperture CutScene tool. (Luckily I already used Unity’s own very capable animation editor to create my cutscenes, so it wasn’t a loss). If you delete these tools and dlls from your project, you will be able to use the bytecode stripping.

E.g @MightyGoober, I would say try ding away with whatever uses “LitJson.dll” and “relasphere-ar.dll” in your project.
If you absolutely must have these external dlls, then you cannot use Bytecde stripping at this time. You will have to export a bigger-sized Game.
Hope this helped someone and also the awesome folks at Unity in their debugging.

Cheers

@buffonomics, thanks for your post. I am getting this error too now and am using 3.4.2f2 Pro for iOS as well and trying to strip down to mscorlib. I’m still green wrt C# assemblies and dll’s. How can I tell what dll’s might deter stripping? Where are they listed in the compiler output in the log? Here’s my log. I probably didn’t include enough here. Thanks in advance for suggestions/pointers.

UnityException: Failed assemblies stripper: /Applications/Unity 3.4.2/Unity.app/Contents/Frameworks/Mono/bin/mono "/Applications/Unity 3.4.2/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe" -l none -c link -a "Assembly-CSharp-firstpass.dll" -a "Assembly-CSharp.dll" -a "Assembly-UnityScript-firstpass.dll" -a "Assembly-UnityScript.dll" -a "C5.dll" -out output -x "/Applications/Unity 3.4.2/Unity.app/Contents/BuildTargetTools/iPhonePlayer/link.xml" -d "Temp/StagingArea/Data/Managed" -x "tmplink.xml" current dir : Temp/StagingArea/Data/Managed
 result file exists: False
stdout: 
stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Type System.Type::MakeGenericType(System.Type[])  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.Process () [0x00000] in <filename unknown>:0   at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0   at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0   at UnusedBytecodeStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultFile)
UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[] input, UnityEditor.RuntimeClassRegistry usedClasses)
UnityEditor.HostView:OnGUI()

Exception: Error building Player: Building player scripts failed.
UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions)
UnityEditor.BuildPlayerWindow.GUIBuildButtons (Boolean enableBuildButton, Boolean enableBuildAndRunButton, Boolean canInstallInBuildFolder)
UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings ()
UnityEditor.BuildPlayerWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj)
UnityEditor.HostView.Invoke (System.String methodName)
UnityEditor.HostView.OnGUI ()

@jackpile your problem is likely the use of whatever uses C5.dll :slight_smile:

The potential trouble maker is usually after:

“Assembly-UnityScript.dll”

And before:

“some unity-based XML. IPhone in your case”
.

See if you can do without whatever uses that dll.
But don’t feel too cheated if you can’t strip. It’s not like you are building for Android which requires a certain hard APK limit of which things become very complicated if you cross. iOS doesn’t care about size, and the stripping would only save you just less than 10 megs anyway.

Hey, good times, I get this now when trying to “Use micro mscorlib”, and I don’t see any extra dlls listed in the error, so what gives?

UnityException: Failed assemblies stripper: /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/mono “/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe” -l none -c link -a “Assembly-CSharp-firstpass.dll” -a “Assembly-CSharp.dll” -out output -x “/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/link.xml” -d “Temp/StagingArea/Data/Managed” -x “tmplink.xml” current dir : Temp/StagingArea/Data/Managed
result file exists: False
stdout:
stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Void System.Security.SecurityException::.ctor(System.String) at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [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 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 UnusedBytecodeStripper.Program.Main (System.String[ ] args) [0x00000] in :0

UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile)
UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[ ] input, System.String[ ] allAssemblies, UnityEditor.RuntimeClassRegistry usedClasses)
UnityEditor.HostView:OnGUI()

Hi, just having the same issue. It’s a vague idea but could it happen because of dynamic typing? If I switch to “Strip ByteCode” the app will crash due to another error when using binaryFormatter.Serialize(memoryStream, graph); where graph is type of ‘object’.

Using “Strip ByteCode” caused by Serialize:
“ExecutionEngineException: Attempting to JIT compile method ‘List`1__TypeMetadata:.ctor ()’ while running with --aot-only.”

Using “micro mscorlib”:
UnityException: Failed assemblies stripper: /Applications/Unity3x/Unity.app/Contents/Frameworks/Mono/bin/mono “/Applications/Unity3x/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe” -l none -c link -a “Assembly-CSharp-firstpass.dll” -a “Assembly-CSharp.dll” -out output -x “/Applications/Unity3x/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/link.xml” -d “Temp/StagingArea/Data/Managed” -x “tmplink.xml” current dir : Temp/StagingArea/Data/Managed
result file exists: False
stdout:
stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Void System.Security.SecurityCriticalAttribute::.ctor(System.Security.SecurityCriticalScope) at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.MarkCustomAttribute (Mono.Cecil.CustomAttribute ca) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.MarkCustomAttributes (ICustomAttributeProvider provider) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.MarkAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.InitializeAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in :0 at Mono.Linker.Steps.MarkStep.Initialize () [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 UnusedBytecodeStripper.Program.Main (System.String[ ] args) [0x00000] in :0

UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile)
UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[ ] input, System.String[ ] allAssemblies, UnityEditor.RuntimeClassRegistry usedClasses)
UnityEditor.HostView:OnGUI()

Had the same problem - thanks for the post, it saved me!!! My issue was resolved in player settings by disabling Stripping Level and setting the Script Call Optimization to Slow and Safe.

You should always do this for Javascript no matter what.

.

We’ve got a similar problem than @Yamilla when building for Wii U, and a similar setup too.

We get 12 “System.Exception: Failed making RPL” events.

@Yamilla Ok, we found the solution! It was just the lack of environment variables configuration. Here’s what you need to do step-by-step to successfully build a project for Wii U (follow cafe docs for a deeper approach on installation steps):

Installs
Install Unity WiiU
Install CAFESDK (unzip) at “C:\” (root directory)
Install Multi
Install CYGWIN (32 bit) at “C:\” (root directory)

Env. variables
Add C:\cygwin to “Path” environment variable
Add var CAFE_ROOT → C:\cafe_sdk
Add var CYGWIN_PATH → C:\cygwin
Add var GHS_ROOT → C:\ghs\multi5321
Add var BRIDGE_IP_ADDRESS → Wii U’s IP
Add var BRIDGE_CURRENT_NAME → Wii U’s MAC Address
Add var MION_BRIDGE_TOOLS → C:\Program files\Nintendo\Hostbridge

Last step
Install Host Bridge
Access to Wii U IP from browser to setup stuff

We are also posting this on the forums as a separate thread:
http://forum.unity3d.com/threads/200186-How-to-solve-CAFE_SDK-build-issues-on-Unity-for-Wii-U-(-quot-Failed-making-RPL-quot-and-so-on)

I have had this problem on two occasions over the last year and am pretty sure that the problem lies in having incorrect symbols in script names.
I think i solved it both times by removing"" from a script name.

1 Like

Had this error too on production.
Network programmer found out that he committed a file originally called “FullSerializer - Unity.dll” and then renamed it to “FullSerializer.dll”.

Into the Editor no error at all, but finally an error was committed on iOS compilation and still refering to the “FullSerializer - Unity.dll” file.
Finally it seems the file couldn’t be renamed or would always commit an error during build.

It took a while to find it out.
Also last thing, switching to stripping level StripByteCode also helped to have a more specific error message on compilation.

The error can also be reference as (Unity 5.0.1f1) :

  • Cross Compilation job Assembly-CSharp.dll failed
  • Unity Exception: Cross compilation Failed
  • AssemblyResolutionException
  • Error building player : Building player scripts failed.

Hope it helps other folks :wink: