Sunday, 28 May 2017

Avoiding Mysterious "Permission denied" Errors During Windows Development: Check Your Services!

A short post to clearly answer a question I've seen un-answered, or answered incorrectly on at least three other major programming forums: if you can compile your program the 'first time' -- in Eclipse, mingw, golang, whatever -- and run it, but the next build/run cycle you get "Permission denied" from the linker or 'go build', or similar -- check that you don't have the "Application Experience" service disabled. It must be set to Manual, Automatic, or Automated (delayed start)... just not Disabled. Otherwise you'll experience this issue, regardless of language, compiler, or IDE, at least on Windows 7.

If you're like me you are in the habit of turning off all sorts of Windows Services on your personal machines to minimize the background crap going on and reduce system memory usage. Well, it's always a matter of tuning to determine what's really required and what isn't. For programming with rapid edit/build/run/debug cycles, it's common to run into this situation.

I have no idea (nor does anyone else, it would seem --Microsoft isn't telling on its own forums) exactly why this service must be enabled to prevent the OS from locking a recently-terminated program executable on disk.

Perhaps (and this is a wild-ass guess), due to the way Application Experience wants to monitor programs, and report if they crash, there's some other OS component in Windows that is waiting for a handshake from the Application Experience service before letting the exeuctable be removed. This might make sense if one needs to send dumps of the .exe or something as part of a crash report.

Anyways... the info on the 'net is confusing about this, so I decided to note it here mostly for myself, for posterity as I've run into it at least 3 times on various Windows systems doing development and it's highly annoying.

No comments:

Post a Comment