I’m attempting to convert our Unity apps to work on Windows 8 and Phone 8 but on compile I get the following error:
Error building Player: Exception: Failed to run reference rewriter with command “–target=“Temp/StagingArea\Assembly-CSharp-firstpass.dll” --framework=“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0,C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Libraries” --platform=“C:\Program Files (x86)\Windows Phone Kits\8.0\Windows MetaData\Windows.winmd” --support=“Temp/StagingArea/WinRTLegacy.dll” --winmdrefs=”" --system=Unity --dbg=pdb --alt=System.Net;System.Net.Sockets,System.Net;System.Xml.Serialization;System.ComponentModel,System.Windows;System.Threading,mscorlib". [Temp/StagingArea\Assembly-CSharp-firstpass.dll]
Catastrophic failure while running rrw: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
at Unity.ReferenceRewriter.RewriteTypeReferences.RewriteObjectListToParamsCall(MethodBody methodBody, Int32 instructionIndex)
at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchMethodBody(MethodBody body)
at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchMethod(MethodDefinition method)
at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchMethods(TypeDefinition type)
at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch()
at Unity.ReferenceRewriter.RewriteOperation.Execute(RewriteContext context)
at Unity.ReferenceRewriter.Program.Main(String[ ] args)
After looking on the web, the most common idea is to stop using Linq’s First() method and use FirstOrDefault(). Unfortunately I am not using either of those methods. I am using Linq in a few places (notably Find()). I upgraded to Unity 4.3 this morning and have VS2012 express for Windows Phone. Thank you in advance!
I’m afraid this fix didn’t make it to 4.3.1 as it was cut off pretty soon…
This error means that you’re using an API which is not available on Windows Phone 8. Just the error message is garbled. Report a bug if you can, we’ll be able to take a closer look at it. Or do a binary search on your code, to find what is that you’re using that isn’t compatible :).
We’re having the same problem too, using Unity 4.3.1. I have just submitted a bug report from inside Unity, but how can I tell what part of my code isn’t compatible? The error message doesn’t seem to have any useful information in it, unless I’m missing it.
Edit: Sorry, I forgot to mention that we’re building for Windows 8 (Metro), not Windows Phone 8, but the error and message are identical to this topic.
The issue affects both platforms: windows phone 8 and windows store apps.
The only useful information the error message contains is on what module exactly the tool failed.
--target="Temp/StagingArea\Assembly-CSharp.dll"
Assembly-CSharp.dll is your C# scripts, Assembly-CSharp-firstpass.dll are your C# scripts that are located in “Plugins”, “Standard Assets” or “Pro Standard Assets” folders, Assembly-UnityScript.dll is your JS scripts and anything else will most likely be plugins.
Other than that, I’m afraid the only 2 options you have is a binary search or waiting for us to fix it. It’s coming up in the next minor release.
What do you mean by a binary search for the code that doesn’t work? What am I searching for? In one of the posts above (from 3 weeks ago) you were able to get the actual error message for someone else. How did you do that? Is that something we can do here, or does it need to be done using a newer build of Unity? I submitted a bug report yesterday with our complete project, if you’re able to let us know the actual error it would be much appreciated. Right now we are completely stalled for our Windows 8 build until we get this fixed. I’m not sure if this makes any difference as far as support goes, but we’re paid Unity Pro users. Thanks!
I used the “Report a Bug” feature inside Unity with the same email address I use in the forum. I didn’t receive an email back, so I’m not sure what the case number is, sorry.