System.UnauthorizedAccessException: Access to the Path is Denied During Azure Pipeline Execution
Hello,
I’m experiencing an issue with our Azure DevOps pipeline running on a self-hosted agent. During the initial execution, the pipeline fails with the following error message:
System.UnauthorizedAccessException: Access to the path ‘D:pathtofile.dll’ is denied.
The error occurs during built-in tasks like Initialize Job and Checkout. However, when I retrigger the pipeline, it passes successfully.
Details:
When the error occurs, the DLL file mentioned in the error is locked, and attempting to delete it manually results in a prompt indicating that the DLL is in use by another process.To mitigate this, I created a PowerShell script that restarts explorer.exe every 5 minutes. This allows the pipeline to pass on retriggering.The issue persists during the initial run of the pipeline, which is causing disruptions.
Questions:
Why does this error only occur during the first execution of the pipeline, and why is it resolved upon retriggering?Could this be related to file lock management by the self-hosted agent, or interference from explorer.exe or other processes?What would be the best approach to avoid this issue altogether, without having to rely on restarting explorer.exe?
Any guidance or recommendations to resolve this issue would be greatly appreciated.
Environment Details:
Agent Type: Self-hostedOS: windows
Hello,I’m experiencing an issue with our Azure DevOps pipeline running on a self-hosted agent. During the initial execution, the pipeline fails with the following error message:System.UnauthorizedAccessException: Access to the path ‘D:pathtofile.dll’ is denied.The error occurs during built-in tasks like Initialize Job and Checkout. However, when I retrigger the pipeline, it passes successfully.Details:When the error occurs, the DLL file mentioned in the error is locked, and attempting to delete it manually results in a prompt indicating that the DLL is in use by another process.To mitigate this, I created a PowerShell script that restarts explorer.exe every 5 minutes. This allows the pipeline to pass on retriggering.The issue persists during the initial run of the pipeline, which is causing disruptions.Questions:Why does this error only occur during the first execution of the pipeline, and why is it resolved upon retriggering?Could this be related to file lock management by the self-hosted agent, or interference from explorer.exe or other processes?What would be the best approach to avoid this issue altogether, without having to rely on restarting explorer.exe?Any guidance or recommendations to resolve this issue would be greatly appreciated.Environment Details:Agent Type: Self-hostedOS: windows Read More