question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WinAppDriver Azure Pipelines Task stop command is flaky

See original GitHub issue

We have recently integrated WinAppDriver into our builds at Accessibility Insights for Windows. We’ve been seeing periodic errors in relation to stopping WinAppDriver in our build pipeline. The YAML we use is as follows:

  - task: WinAppDriver.winappdriver-pipelines-task.winappdriver-pipelines-task.Windows Application Driver@0
    displayName: 'Stop - WinAppDriver'
    inputs:
      OperationType: Stop

This usually works as expected, but sometimes fails with:

  | ##[error]The process cannot access the file 'D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\winappdriverlog.txt' because it is being used by another process. |  

Full log output at end of issue.

Do you know if there is something we may be doing that causes this error? Or is it an issue with the build task itself?

  | ##[debug]Evaluating condition for step: 'Stop - WinAppDriver' |  
  | ##[debug]Evaluating: SucceededNode() |  
  | ##[debug]Evaluating SucceededNode: |  
  | ##[debug]=> True |  
  | ##[debug]Result: True |  
  | Starting: Stop - WinAppDriver |  
  | ============================================================================== |  
  | Task         : WinAppDriver |  
  | Description  : Use this extention to integrate Windows Application Driver (WinAppDriver) into your Azure Pipeline. |  
  | Version      : 0.0.1 |  
  | Author       : Microsoft |  
  | Help         : Checkout the WinAppDriver GitHub Repo to learn more - https://github.com/Microsoft/WinAppDriver |  
  | ============================================================================== |  
  | ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4 |  
  | ##[debug]Entering D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\WADPowershell.ps1. |  
  | ##[debug]Loading resource strings from: D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\task.json |  
  | ##[debug]Loaded 0 strings. |  
  | ##[debug]SYSTEM_CULTURE: 'en-US' |  
  | ##[debug]INPUT_OPERATIONTYPE: 'Stop' |  
  | ##[debug]INPUT_WADARGUMENTS (empty) |  
  | ##[debug]INPUT_AGENTRESOLUTION: 'Default' |  
  | Successfully closed WinAppDriver on Agent |  
  |   |  
  | Printing WinAppDriver Console logs: |  
  |   |  
  | ##[debug]Caught exception from task script. |  
  | ##[debug]Error record: |  
  | ##[debug]Out-File : The process cannot access the file 'D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\winappdriverlog.txt' because it is being used by another process. |  
  | ##[debug]At D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\WADPowershell.ps1:41 char:2 |  
  | ##[debug]+     Out-File -Encoding Unicode -append winappdriverlog.txt |  
  | ##[debug]+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |  
  | ##[debug]    + CategoryInfo          : OpenError: (:) [Out-File], IOException |  
  | ##[debug]    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand |  
  | ##[debug] |  
  | ##[debug]Script stack trace: |  
  | ##[debug]at <ScriptBlock>, D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\WADPowershell.ps1: line 41 |  
  | ##[debug]at <ScriptBlock>, <No file>: line 1 |  
  | ##[debug]at <ScriptBlock>, <No file>: line 22 |  
  | ##[debug]at <ScriptBlock>, <No file>: line 18 |  
  | ##[debug]at <ScriptBlock>, <No file>: line 1 |  
  | ##[debug]Exception: |  
  | ##[debug]System.IO.IOException: The process cannot access the file 'D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\winappdriverlog.txt' because it is being used by another process. |  
  | ##[debug]   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) |  
  | ##[debug]   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) |  
  | ##[debug]   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) |  
  | ##[debug]   at System.Management.Automation.PathUtils.MasterStreamOpen(PSCmdlet cmdlet, String filePath, Encoding resolvedEncoding, Boolean defaultEncoding, Boolean Append, Boolean Force, Boolean NoClobber, FileStream& fileStream, StreamWriter& streamWriter, FileInfo& readOnlyFileInfo, Boolean isLiteralPath) |  
  | ##[error]The process cannot access the file 'D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\winappdriverlog.txt' because it is being used by another process. |  
  | ##[debug]Processed: ##vso[task.logissue type=error]The process cannot access the file 'D:\a\_tasks\Windows Application Driver_f7c56e2a-d1f1-4cff-b5d3-a32c9516c6e0\0.0.1\winappdriverlog.txt' because it is being used by another process. |  
  | ##[debug]Processed: ##vso[task.complete result=Failed] |  
  | Finishing: Stop - WinAppDriver

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
rubberduck203commented, Jul 23, 2019

Closing this issue is a little premature IMO. The fix for this issue introduced a new bug that we’re also seeing. Also on a self hosted agent. My extension settings are saying 0.0.1.7 is the latest version.

1reaction
jalkirecommented, Jul 18, 2019

@hassanuz Our most recent build ran with the 0.0.2 version of the task and did not hit this issue. I will let you know if we see it again; if not, consider it fixed. Thanks! As for agent info, we were running on what I believe is a default Azure Pipelines agent using the windows-2019-vs2019 image. Its agent version was 2.154.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage flaky tests - Azure Pipelines
System detection: The in-product flaky detection uses test rerun data. The detection is via VSTest task rerunning of failed tests capability or ...
Read more >
How To Automate Desktops Apps Using WinAppDriver
This blog deep dives by telling you How To Automate Desktops Apps Using WinAppDriver. It also leverages WinAppDriver on HyperExecute Cloud ...
Read more >
Azure Pipelines Sprint 195 Update
When you have a flaky task that fails intermittently in a pipeline, you may have to re-run the pipeline to have it succeed....
Read more >
WinAppDriver in Azure devops pipeline to test applications
I believe you can use WinAppDriver CI task on your pipeline ... here - task: Windows Application Driver@0 inputs: OperationType: 'Stop'.
Read more >
Install UWP app on Azure Pipelines for testing
I'm looking for a little help with Azure Pipelines. We've written some UI tests using WinAppDriver, and are attempting to get them up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found