Internal Compiler Error

Hello. I have been working in this game engine for the last year or two, and now I am getting an error saying: Internal Compiler Error: Unhandled Exception etc. Here is the full log with all of the information:

----------
BatchMode: 0, IsHumanControllingUs: 1, StartBugReporterOnCrash: 1, shouldGiveDebuggerChanceToAttach: 0
Initialize mono
Mono path[0] = 'C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/2.0'
Mono path[1] = 'C:/Program Files (x86)/Unity/Editor/Data/Managed'
Mono path[2] = 'C:/Program Files (x86)/Unity/Editor/Data/UnityScript'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y
Direct3D:
    Version:  Direct3D 9.0c [nvd3dum.dll 8.17.12.6658]
    Renderer: NVIDIA GeForce GTX 460
    Vendor:   NVIDIA
    VRAM:     768 MB
    Caps:     Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 DF24=0 INTZ=1 RAWZ=0 NULL=1 RESZ=0 SlowINTZ=0
IsTimeToCheckForNewEditor: Update time 1308771632 current 1308769482
LicenseInfo:InitializeProtection
  open PACE from our own executable
  opened PACE, get info...
  checked authorization, authstate=100 r=0
  ReadDeveloperData
  ReadTokens
C:/Users/Joey/Desktop/zombie survival wip/FPSc Project

Unloading -2 unused Assets to reduce memory usage. Loaded Objects now: 45.
System memory in use: 94.9 MB.
Unloading 20 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.dll (this message is harmless)
Non platform assembly: data-073B0850 (this message is harmless)
Non platform assembly: data-0739D238 (this message is harmless)
Non platform assembly: data-0EBA0048 (this message is harmless)
Non platform assembly: data-0EBCF270 (this message is harmless)
Non platform assembly: data-073A1240 (this message is harmless)
Non platform assembly: data-0EBE00B8 (this message is harmless)
Non platform assembly: data-0EC052E0 (this message is harmless)
Non platform assembly: data-0EC06AE8 (this message is harmless)
Non platform assembly: data-0EC4AAF0 (this message is harmless)
Non platform assembly: data-073D36D8 (this message is harmless)
Non platform assembly: data-0EC50FB0 (this message is harmless)
Non platform assembly: data-0EC69868 (this message is harmless)
Non platform assembly: data-0EC7AB20 (this message is harmless)
Non platform assembly: data-0ECC1B48 (this message is harmless)
Non platform assembly: data-0EFF0020 (this message is harmless)
Non platform assembly: data-0ECDE190 (this message is harmless)
Non platform assembly: data-0ECF55B8 (this message is harmless)
Non platform assembly: data-0ED31F70 (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.West.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\UnityScript.Lang.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Core.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\UnityScript.dll (this message is harmless)
Non platform assembly: C:\Users\Joey\Desktop\zombie survival wip\FPSc Project\Assets\Assets\bin_Tools\dashboard\ExitGamesLibs.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\WindowsBase.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Messaging.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\Mono.Messaging.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Web.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Configuration.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Xml.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Data.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Drawing.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\Microsoft.VisualC.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Web.Services.dll (this message is harmless)
Mono: successfully reloaded assembly
- starting compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll, for buildtarget 5
- starting compile Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll, for buildtarget 5


-----Compiler Commandline Arguments:

Filename: "C:/Program Files (x86)/Unity/Editor/Data/Mono\bin\mono.exe"

Arguments: "C:/Program Files (x86)/Unity/Editor/Data/Mono\lib/mono/unity\smcs.exe"  @Temp/UnityTempFile-470000575d5739e4ba310a10b458df24

MONO_PATH: C:/Program Files (x86)/Unity/Editor/Data/Mono\lib\mono\unity

MONO_CFG_DIR: C:/Program Files (x86)/Unity/Editor/Data/Mono\etc

index: 74

Responsefile: Temp/UnityTempFile-470000575d5739e4ba310a10b458df24 Contents: 

-debug

-target:library

-nowarn:0169

If you have some plugins make sure that they are not missing any dependencies. If your using a DLL make sure all the DLLs it needs are also included.

I found, finally, that Gamedraw asset caused this issue. Took a while to isolate.

I’ve been having internal compiler errors in my project also, and there are a couple things I’ve found that could help.

First, there is a technique which works well for narrowing-down where the internal compiler error happens.

First the thought process:

A) I noticed that compiler errors showing up in Visual Studio, when I attempted to build the project there (which failed because Unity hadn’t built the DLL file, btw), were not showing up in the Unity console/error log.

B) This made me realize that the internal compiler error must be happening at some specific line in some specific file, and that once it hit that line, it stopped compiling the rest of the files. (and thus it never noticed the normal code issues (e.g. “int i = 0 / 0;”) that Visual Studio picked up)

C) I looked into the Unity Editor logs, and noticed that the files were all being sent to the compiler in alphabetical order–in other words, in basically the same order you see them in the Project view. (the one difference being how they handle capital letters–Unity and Visual Studio consider ‘a’ to be before ‘B’, whereas the compiler considers ‘a’ to be after ‘B’, since ‘B’ is capitalized, and it always puts capitalized letters first (presumably because capitalized letters come first in the character map))

D) I realized that I could find which file the ‘internal compiler error’ happened in by intentionally creating normal compile errors at the bottom of each file, in turn, until I saw the normal error not show up in the Console. (indicating that it came after the internal-compiler-error-causing line)

So now:

Tip #1) The technique.

If you get an ‘internal compiler error’:

  1. Place the following code at the very bottom of the first (alphabetically speaking) script file: (in other words, the top-most script file in the Project view)

    class CompileBreaker { public CompileBreaker() { var i = 0 / 0; } }

  2. If you still get the ‘internal compiler error’, then the issue is somewhere in the file. (you can try placing the CompileBreaker at the top, just to make sure) If not, then remove the CompileBreaker code from the file, and add it to the bottom of the next file.

  3. Repeating steps 1 and 2 for each script file, in alphabetical order.

The first time I used this technique, (which was just a few minutes ago), I was pretty lucky. I found the cause of my ‘internal compiler error’ in the second file, “Core.cs”. Which brings me to my next point, which is that…

Tip #2) The Mono compiler for Unity apparently has an issue with partial classes.

Here is the file I found to have caused the internal compiler error, with the error-causing line marked:

using System;

namespace ManagedLzma.LZMA.Master
{
    public static partial class LZMA // <<< the line that caused the 'internal compiler error'
    {
        [System.Diagnostics.Conditional("SHOW_DEBUG_INFO")]
        internal static void DebugPrint(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(String.Format(format, args));
        }

        internal static void Print(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(String.Format(format, args));
        }
    }
}

class CompileBreaker { int i = 0 / 0; } // my CompileBreaker code that wasn't reached

I removed the word “partial” from the line, and changed the class name to “LZMA_RenamedForNow”, and the compiler successfully reached the CompileBreaker code at the bottom. I then moved the CompileBreaker code to the next file, found the same issue (with it having “partial” class declarations), and fixed it. Moved the CompileBreaker to the next file. And so on.

Each time the CompileBreaker code is reached, you know the code up to that point is fine, so you just move it to the bottom of the next file.

It’s worked really well for helping me solve this sort of problem, that is otherwise almost pure guesswork. (before this I was trying to delete and comment out files and code blocks, but that became very difficult because the library with the issues has dozens of classes which are interlinked with each other–causing early, normal compile errors, that blocked my ability to see where the ‘internal compiler error’ was lying (since the ‘internal compiler error’ is only seen if it doesn’t encounter normal errors first))

Anyway, hope this helps anyone still having issues with finding where their project’s ‘internal compiler errors’ lie.