What happens in 'assembly purgatory'?
-
19-09-2019 - |
Question
When a .NET assembly is deployed to the GAC and the destination file is locked, Windows holds it in what I can best guess is some sort of 'assembly purgatory' - c:\windows\assembly\temp
.
Using Process Explorer these can easily be seen when searching for the suspect DLL:
(source: alexangas.com)
As soon as I end the process locking the file (in this case OWSTIMER.EXE) it is magically deployed to the GAC correctly.
I'm curious as to what Windows is actually doing here. How does it know when the file lock has been released? Where does it keep the record of locked files? Does it ever give up?
Solution
Temp
and tmp
are temporary folders used during GAC Assembly installation and uninstallation. Tmp
is used for installation, and Temp
is used for uninstallation.
Source: GAC Temp and Tmp
.NET Runtime Optimization Service (mscorsvw.exe
) is probably probing files once in a while to check if they are closed so it can [un]install pending assemblies.
I may be wrong, but as far as I know, there is no WinAPI which would notify you that certain file has been closed/unlocked. You have to monitor them by yourself. But Windows itself must have such a list somewhere in memory (at least it has a list of open handles), so it just knows that the file is closed, because the handle representing the file is released.