docs/workflow/testing/visualstudio.md
Visual Studio is a great tool to use when working in the dotnet/runtime repo.
Almost all its features should work well, but there are a few special considerations to bear in mind:
You can run tests from the Visual Studio Test Explorer, but there are a few settings you need:
Auto detect runsettings Files (Test Explorer window -> Settings button -> Options). Test parameters (like which dotnet host to use) are persisted in an auto-generated .runsettings file, and it's important that Visual Studio knows to use it.Processor Architecture for AnyCPU project to auto (Test Explorer window -> Settings button).Discover tests in real time from C# and Visual Basic .NET source files (Test explorer window -> Settings button -> Options).
[SkipOnTargetFramework], to indicate that they're only valid in certain configurations. Because the real-time discovery feature does not currently recognize these attributes the tests will show up in Test Explorer as well, and fail or possibly hang when you try to run them.Run tests in Parallel (Test Explorer window -> Settings button).
If you encounter puzzling behavior while running tests within Visual Studio, first check the settings above, verify they run correctly from the command line, and also make sure you're using the latest Visual Studio. It can be helpful to enable detailed logging of the test runner (Test explorer window -> Settings button -> Options > Logging Level: Trace) - it may suggest the problem, or at least provide more information to share.
dotnet/runtime uses dotnet test (VSTest) which spawns child processes during test execution.
Visual Studio by default doesn't automatically debug child processes, therefore preliminary steps need to be done to enable Debugging "F5" support.
Note that these steps aren't necessary for Visual Studio Test Explorer support.
Debug -> Other Debug Targets -> Child Process Debugging Settings...), enable the "Enable child process debugging" option and hit save.Debug -> $ProjectName Properties) and enable the "Enable native code debugging" option.