We have an on-premises, TFVC setup with Azure Devops 2019. We use the "Classic Editor" to create our pipelines since YAML does not support the TFVC repository: https://developercommunity.visualstudio.com/t/enable-yaml-for-tfvc/234618
We have a sporadic crash during the test run that brings down the entire suite. We're just using MSTest and the Visual Studio Test Task as you can see below. As you can see, I have enabled the "Collect advanced diagnostics" option:
However, as you can see in the output, the option is only enabled to 'true' on the first pass of 'Run the tests locally' where no assemblies are found? On the second pass, when it finds the assemblies, the option is 'false' and the command line is not updated.
How can I get diagnostics enabled for the second pass? There's only one Visual Studio Test task in the pipeline and it seems it picks up the /InIsolation parameter fine so I was surprised to see the diagnostics option disabled. Why are there two passes happening anyway?
Thanks.
UPDATE 1
After turning on system.debug, I noticed a few dlls being found that contained the word "test" but were not test assemblies so I changed **\*test*.dll
to **\*Tests.dll
to clean this up. After this, I finally saw the following in the log file:
/diag:"H:\visbuild2\_work\_temp\f7742940-b794-11eb-9d69-699b53f653ca.txt"
Starting test execution, please wait...
Logging Vstest Diagnostics in file: H:\visbuild2\_work\_temp\f7742940-b794-11eb-9d69-699b53f653ca.txt
Logging TestHost Diagnostics in file: H:\visbuild2\_work\_temp\f7742940-b794-11eb-9d69-699b53f653ca.host.21-05-17_22-53-21_51202_1.txt
...
Results File: H:\visbuild2\_work\778\s\TestResults\tfsservice_VIS-BUILD_2021-05-17_22_53_25.trx
Total tests: Unknown. Passed: 353. Failed: 0. Skipped: 0.
Test Run Aborted.
So this is progress but the issue now is that the H:\visbuild2\_work\_temp
location is above the current build location and seems to be shared among all builds so the files were quickly deleted by another build. I tried changing the location via the 'Other console options' like so:
/Blame:CollectDump;CollectAlways=true;DumpType=full /Diag:"$(BuildLocation)\testlog.txt";tracelevel=verbose
But this produced the error that /Diag cannot be specified twice. I then tried unchecking the "Collect advanced diagnostics" option but strangely, I got the same error that /Diag was specified twice. Is there a way to change the location where the diagnostics file is produced? Of course, I still have no indication that the crash dump was created despite the test run having been aborted.
UPDATE 2
It seems that /diag is only enabled with system.debug is set to true: https://github.com/microsoft/vstest-docs/blob/master/docs/diagnose.md