internal compiler error: Unhandled Exception: System.UnauthorizedAccessException:

starting with unity 3.5.1 i get an internal compiler error almost every time i want to compile a project, unity has no access on his own temp folder.

I have this problem on 5 different projects. Sometimes let unity recompile all scripts help.

here is the editor.log

- starting compile Library/ScriptAssemblies/Assembly-CSharp.dll, for buildtarget 5
- starting compile Library/ScriptAssemblies/Assembly-UnityScript.dll, for buildtarget 5
Refresh, detecting if any assets need to be imported or removed ... 0.039615 seconds (Nothing changed)

*** Cancelled 'Build.Player.WindowsStandalonePlayer' in 2 seconds

- Finished compile Library/ScriptAssemblies/Assembly-UnityScript.dll
- Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
- starting compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll, for buildtarget 5


-----Compiler Commandline Arguments:

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

Arguments: "C:/Program Files (x86)/Unity3.5/Editor/Data/Mono\lib/mono/2.0\gmcs.exe"  @Temp/UnityTempFile-86f6a6f0ebb6c4142ab31254f43edc8b

MONO_PATH: C:/Program Files (x86)/Unity3.5/Editor/Data/Mono\lib\mono\2.0

MONO_CFG_DIR: C:/Program Files (x86)/Unity3.5/Editor/Data/Mono\etc

index: 75

Responsefile: Temp/UnityTempFile-86f6a6f0ebb6c4142ab31254f43edc8b Contents: 

-debug

-target:library

-nowarn:0169

-out:Temp/Assembly-CSharp-Editor.dll

-r:"C:/Program Files (x86)/Unity3.5/Editor/Data/Managed/UnityEngine.dll"

-r:"C:/Program Files (x86)/Unity3.5/Editor/Data/Managed/UnityEditor.dll"

-r:Library/ScriptAssemblies/Assembly-CSharp.dll

-r:Library/ScriptAssemblies/Assembly-UnityScript.dll

-define:UNITY_3_5_1

-define:UNITY_3_5

-define:UNITY_EDITOR

-define:ENABLE_PROFILER

-define:UNITY_STANDALONE_WIN

-define:ENABLE_GENERICS

-define:ENABLE_DUCK_TYPING

-define:ENABLE_TERRAIN

-define:ENABLE_MOVIES

-define:ENABLE_WEBCAM

-define:ENABLE_MICROPHONE

-define:ENABLE_NETWORK

-define:ENABLE_CLOTH

-define:ENABLE_WWW

-define:ENABLE_SUBSTANCE

Assets/Editor/GUIDraggableObject.cs

Assets/Editor/MyBuildManager.cs

Assets/Editor/SceneObject.cs



-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll

-----CompilerOutput:-stderr----------



Unhandled Exception: System.UnauthorizedAccessException: Access to the path "C:\work\BMWn\produktion\verkehr\unity\Temp\Assembly-CSharp-Editor.dll.mdb" is denied.



  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 



  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0 



  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0 



  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)



  at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile (Guid guid) [0x00000] in <filename unknown>:0 



  at Mono.CSharp.SymbolWriter+SymbolWriterImpl.WriteSymbolFile () [0x00000] in <filename unknown>:0 



  at Mono.CSharp.SymbolWriter.WriteSymbolFile () [0x00000] in <filename unknown>:0 



  at Mono.CSharp.CodeGen.Save (System.String name, Boolean saveDebugInfo, Mono.CSharp.Report Report) [0x00000] in <filename unknown>:0 



  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 



  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

-----EndCompilerOutput---------------

- Finished compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.UnauthorizedAccessException: Access to the path "C:\work\BMWn\produktion\verkehr\unity\Temp\Assembly-CSharp-Editor.dll.mdb" is denied.

  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 

  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0 

  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0 

  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)

  at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile (Guid guid) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.SymbolWriter+SymbolWriterImpl.WriteSymbolFile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.SymbolWriter.WriteSymbolFile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.CodeGen.Save (System.String name, Boolean saveDebugInfo, Mono.CSharp.Report Report) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: 0)

When you ever catch your admin installing a virus scanner on your development machine, grab a stick help him to understand that this is a very bad idea …

1 Like

Yes, I can confirm this is caused by McAfee. I’ve been using Unity (I am on version 4.1 now) for over a year and I never had any problems with it, until a few days ago, that is. McAfee started acting up that day, saying something about some IP trying to access my computer, even though the IP was that of my own machine. At about the same time I started getting the above error in Unity after making any change to any of my C# scripts. I Googled it and saw a few people saying it might be related to McAfee. So then I disabled the McAfee firewall and real-time scanning and the problem went away. On the next day though, it started happening again and nothing I did helped. The interesting thing was that my subscription to McAfee expired on that day, but when I looked at my machine’s Services, several McAfee services were still running and I could not stop them. I tried running Unity as an administrator, as some people on the Internet had suggested that, but that didn’t help either.

At this time the error was happening after every single change I made to any C# script, so clearly, I could not do any development at all. Very frustrated, I resorted to the last measure I could think of, re-install McAfee from my machine and lo and behold, that fixed my problem. The error immediately went away.

What I noticed before I un-installed McAfee was that every time I started up Unity, it would create that file, Assembly-CSharp-Editor.dll.mdb, in the Temp folder where my Unity project was. After I un-installed it though, that file was no longer being created.

3 Likes