Video datacollector cannot be found when using dotnet vstest or dotnet test.
dotnet vstest $dll /collect:'Screen and Voice Recorder' /resultsdirectory:c:\temp
Video recorder functions as it does when calling vstest.console.exe
Data collection : Unable to find a datacollector with friendly name 'Screen and Voice Recorder'.
Data collection : Could not find data collector 'Screen and Voice Recorder'
I also tried to set the path to the data collector but it would generate errors.
dotnet vstest $dll /tests:test0 /collect:'Screen and Voice Recorder' /resultsdirectory:c:\temp /TestAdapterPath:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\"
Microsoft (R) Test Execution Command Line Tool Version 16.8.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test discovery, please wait...
A total of 1 test files matched the specified pattern.
Data collector 'Screen and Voice Recorder' message: Data collector caught an exception of type 'System.IO.FileNotFoundException': 'Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'. More details: The type initializer for 'Microsoft.VisualStudio.TestTools.DataCollection.MediaRecorder.MediaFoundationRecorder' threw an exception...
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 4 ms
Windows 10 w/ VS 2019, 2017 & net5.0
Please use dotnet test instead of dotnet vstest and also you should specify runsettings file and add video collectors there.
Please refer this documentation Screen and Voice Recorder.
@Sanan07 I have the same error using dotnet test and when specifying the recorder in the runsettings.
This is only an issue when using dotnet test. The same runsettings or command lines work when using vstest.console
@JDCain Yes, I was able to reproduce the issue. Seems that the problem with Screen and Voice Recorder, cause it works fine with Code Coverage data collector setting in runsettings file. Will try to look at it.
As far as I know, Screen and Voice Recorder data collector doesn't ship with dotnet. You might need to use vstest.console.exe shipped with Visual Studio, or use the one in the Microsoft.TestPlatform package.
Is there a way to point to it using /TestAdapterPath ?
When I attempted to it would not work but I suspect I am not setting the path right.
It might be possible. I need to verify it thou. I'll let you know on Monday :)
So I just checked it. Screen and Voice Recorder is not compatible with dotnet test. It would be best if you use the NuGet package (or vstest.console.exe shipping with Visual Studio).
@Haplois
Good to know. I started writing my own using ffmpeg as a work around.
Because I am curious, is the incompatibility due to dependencies which are not included in dotnet, like System.Configuration.ConfigurationManager?
Parts of Screen and Voice Recorder is only supported on Windows and not compatible with dotnet, I think that's the main reason. I am not sure, but I think it's only available with VS Enterprise SKU; this might be another issue.