Unable to Compile Applications in the Studio?
by
, 3-Nov-2011 at 01:21 PM (14123 Views)
Do you use Windows 7 or Windows Vista? Are you having problems compiling your application in the Studio? I'm not talking about compiler errors, I'm talking about the Studio reporting that it cannot delete the old application .exe file before compiling the new one! If you are seeing that problem then read on, I may have the solution (or at least a little good advice)...
System Tune Up
Ages ago I had turned off the windows Application Experience service while trying to tune up my computer. By reading the service description it didn't seem necessary and indeed it did not cause any problems at the time I turned off the service.
www.BlackViper.com describes the Application Experience service as follows...
This service checks a Microsoft maintained database for known problems with popular programs and automatically enables workarounds, either at first installation (using UAC) or at application launch.
Turning off this feature may increase over all application responsiveness at launch time (due to avoiding the database look up), however, it will not fix application installation issues.
Seems OK to turn this off then.
Windows 7 Service Pack - Problems Begin
Much later, after a major Windows 7 update, I started having problems compiling web applications from the Studio. The Output Panel displayed an error from the linker that the old WebApp.exe was locked and could not be deleted.
At first I thought this was a problem with the way the Studio shuts down the WebApp before attempting a compile. I tried running the Studio in the debugger and pausing the compile operation after the Studio shuts down the Web App. I found that if I waited (anything from 5-30 minutes) before allowing the compile, then the WebApp.exe would be released and the compile would go ahead. After much checking I could not see any problems in the Studio or the way that it was stopping the WebApp.
I found that usually, if I delete the .exe manually (from windows explorer) before compiling, then it would be OK. Sometimes though I could not even delete the file manually.
Later, after further Windows updates, this problem started to get worse. Soon I was also having problems compiling Windows applications, and as time went on the period I needed to wait before the compile would work without manual intervention grew larger. It seemed there was some Windows caching of file deletes or some file locks of some kind that are interfering with attempts to delete the file.
No one else I talked to was seeing this problem, this is when your mind starts to play tricks. Usually at this point I become convinced that I have a virus or there is some malware on my computer. Of course I scanned everything, but could not find a problem. Then I blamed the fact that I am running Windows 7 on a MacBook Pro, that has to be it! But I am running Windows 7 natively, I am not using a virtual machine, and I haven't had any problems with the MacBook running windows before.
The Problem Spreads
Sometimes a problem gets so bad you just have to find a solution. I never had any problem downloading .exe files onto my Windows 7 machine... until today. Today, after a recent Windows update, I tried to download a new build of Visual DataFlex 17.0. The downloader creates two files as it downloads: a "xyz.exe.part" file and a "xyz.exe" file. At the end of the download the .xe file is deleted and the .part file is renamed as "xyz.exe". But the downloader failed when it tried to delete the .exe file. Windows was reporting that I did not have permission to write to this directory!!"
Now this is something that really annoys me about modern operating systems, Windows in particular. I paid for this darn computer, it belongs to me!! I am logged in as administrator and the directory is the "Download" directory that belongs to this user ID. Where does Windows 7 get off telling me I don't have permission to save my file in my directory on my computer!!
Microsoft Wishes You a Happy Application Experience
It turns out that the Application Experience service, that I deleted months ago, somehow manages cached deletes of .exe files made by other applications. Arrrgh! According to a Blog entry on www.retrocopy.com:
It seems when this service is disabled and a user tries to delete an EXE file windows firstly looks for it in the "application cache" and is unable to perform the deletion. Process monitor shows the file is "DELETE PENDING", which basically means it's marked for deletion it just isn't deleted yet. The most common reason for this is a handle to the file still existing somewhere. However with the "Application Experience" service disabled there is no visible handle, at least that can be seen in tools which show these things. The file does get deleted after some time, 30 seconds to 30 minutes later, instead of being instantly deleted (as users would expect it to be) with the service enabled.
Turn this service back on and the problem goes away (yay).