I used these instructions to set up VS Code for debugging corefx. However, the dotnet in the program path: corefx/bin/testhost/netcoreapp-Linux-{Configuration}-{Architecture} (adjusted to include artifacts as is current directory structure) failed for me with:
The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
- The following frameworks were found:
5.0.0 at [/home/manicka/corefx/artifacts/bin/testhost/netcoreapp-Linux-Debug-x64/shared/Microsoft.NETCore.App]
The 5.0.0 is a version of dotnet residing in artifacts/bin/testhost/, the 2.1.0 is in xunit console configuration in the test bin directory (artifacts/bin/System.Net.NetworkInformation.Functional.Tests/netcoreapp-Debug/xunit.console.runtimeconfig.json).
I got it eventually running with using dotnet from .dotnet/dotnet directory and changing the xunit configuration to reflect its version.
And I'm using Visual Studio Code with WSL2.
I'm not sure if what I'm doing is right. If I'm not, please tell me how to do it right.
I'll gladly update the documentation once it's clear what's the right set up.
Pinging: @ViktorHofer, @wtgodbe you're the last people editing this part of the doc.
I'm not sure if what I'm doing is right. If I'm not, please tell me how to do it right.
Unfortunately not. You aren't running against the live built assets but instead against the shared framework that comes with the SDK (currently 3.0.0-preview7). I'll take a look.
Can you please share your launch.json file?
Unfortunately not. You aren't running against the live built assets but instead against the shared framework that comes with the SDK (currently 3.0.0-preview7). I'll take a look.
Yeah, I noticed that it's not loading my currently built dlls. I changed the path to testhost dir and updated the xunit config to use 5.0.0 version, this combination works as well.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/../../artifacts/bin/testhost/netcoreapp-Linux-Debug-x64/dotnet",
"args": ["xunit.console.dll", "System.Net.NetworkInformation.Functional.Tests.dll", "-parallel", "none", "-class", "System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest"],
"cwd": "${workspaceFolder}/../../artifacts/bin/System.Net.NetworkInformation.Functional.Tests/netcoreapp-Debug",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
You are missing some args which is the reason why you needed to update the version in the runtimeconfig.json file.
When doing an dotnet msbuild /t:RebuildAndTest you can see the used arguments. Everything after dotnet.exe is an argument:
"C:\git\corefx\artifacts\bin\testhost\netcoreapp-Windows_NT-Debug-x64\dotnet.exe" exec --runtimeconfig System.Runtime.Extensions.Tests.runtimeconfig.json xunit.console.dll System.Runtime.Extensions.Tests.dll -xml testResults.xml -nologo -notrait category=nonnetcoreapptests -notrait category=nonwindowstests -notrait category=OuterLoop -notrait category=failing
Thanks a lot @ViktorHofer, the culprit was the missing runtime config.
I'll update the doc accordingly, so please don't close it yet.
If you make doc changes please don't hardcode the existing arguments as they are likely to change. Instead I would mention that all arguments need to be specified and how to retrieve them.
Most helpful comment
When doing an
dotnet msbuild /t:RebuildAndTestyou can see the used arguments. Everything after dotnet.exe is an argument: