Debugging Azure DevOps
and the .NET Core Test Runner
A couple of quick ways of debugging your .NET DevOps pipeline that you may find useful:
A handy debug idea is to look at the docs for the tasks in your pipeline, and add to their arguments to produce more verbose output. This has the benefit of being tailored to the specific task you're debugging.
dotnet test has a
--verbosity option, which you can set to q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (see the docs). The default is minimal, so this can be helpful in determining issues with the task itself. Beware that detailed and diagnostic can produce thousands of lines of output!
System.Debug and system diagnostics
If you choose to run a pipeline manually, you may have seen the option Enable system diagnostics:
Enabling this will produce lots of debug output regarding the tasks, runners, and agents, which will enable you to debug the pipeline infrastructure.
If you find it useful, you can enable this all the time (including automatic builds) by adding a variable to your
buildPlatform: 'Any CPU'
Note that many tasks also support variables, so you can apply System.Debug selectively to those tasks instead of the whole pipeline. In this case, I would recommend creating a pipeline variable, which will allow you to manually run the pipeline with the debug option for specific tasks only. To do this:
At the top-right of your web-based pipeline editor, you will see a Variables button:
Select New Variable or click the + button if you already have variables
- give it a name, such as selectiveDebug
- create the default value of
- select Let users override this value when running this pipeline
- now add this to your desired jobs:
And now when you manually run a pipeline, you can choose to enable debugging for those jobs only without editing your yaml.
jobs: - deployment: deploy_api displayName: Deploy Vapour Ware API variables: System.Debug: '$(selectiveDebug)'
What other debugging options do you use? Comment and let me know!