Constantly getting this error

The following error message has popped up in my console literally dozens of times now and I’d like to get it resolved permanently:

Unhandled Exception: System.UnauthorizedAccessException: Access to the path “C:\Users\Gerald\Desktop\Game Design\Game Name\Temp\Assembly-CSharp.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 :0

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

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

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

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

at Mono.CSharp.SymbolWriter.WriteSymbolFile () [0x00000] in :0

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

at Mono.CSharp.Driver.Compile () [0x00000] in :0

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

Whenever this happens, I have to manually save my C# script with “Save As”, then save my scene, then save my project and close the program entirely, then reload it before it’ll let me continue working in it.

Thoughts?

Not sure if this is relevant or not, but maybe check anti-virus and see if it’s locked the mdb file.

1 Like

We’re seeing more and more UnauthorizedAccessExceptions during compiles, on different computers with different anti-virus software. It’s always one of the .dll.mdb files - either CSharp or Boo - on games written in CSharp and Boo respectively. I haven’t been able to lock it down enough to send a bug report, but I’m pretty certain that this is a consistent error.

I can usually fix it by just adding a space to whatever script I’m working on - recompiling is not enough, though.

1 Like

1). Unblock unity editor in av firewall settings.
2). Temporarily turn off any av real time scanning.
3). Launch unity as administrator.

just my top 3.

P

1 Like

K thanks everybody

I get this too. Already tried adding exceptions in my antivirus and now I just turn it off. Unity and Monodevelop both running as admin. Still happens continually. Every time I save a file through Mono, I have to close and restart unity (sometimes a few times) to get rid of the error.

---- Edit ----

As Baste indicated, sometimes adding a space removes the error but I’ve found it needs to be done a couple of times.