gpt4 book ai didi

c# - Visual Studio Code .NET Core 调试器未命中断点

转载 作者:行者123 更新时间:2023-12-03 18:41:47 25 4
gpt4 key购买 nike

我在尝试在 Visual Studio Code 中调试用 .NET Core 编写的应用程序时遇到问题。这是设置:
我正在使用运行 Debian 9(使用默认 GUI)的虚拟机。我已经安装了 .Net Core SDK 2.1 和 Visual Studio Code 1.30.0。安装了 C# 1.17.1 的扩展。我创建了一个简单的项目:

class MyProgram
{
static void Main(string[] args)
{
Console.WriteLine("Hello You Angel!");
ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "/bin/bash", Arguments = "-c nautilus /home/", };
Process proc = new Process() { StartInfo = startInfo, };
proc.Start();
}
}

如果我运行程序,in 会执行并产生正确的输出。
在调试窗口中,我按下齿轮按钮来编辑 launch.jason文件 Debug window

这是它的样子:
{
"version": "0.2.1",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/HelloWorld/bin/Debug/netcoreapp2.1/HelloWorld.dll",
"args": [],
"cwd": "${workspaceFolder}/HelloWorld",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"externalConsole": false,
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}

我在项目中放置了一个断点:
Breakpoint

当我点击绿色三角形按钮时,断点没有命中。实际上,我认为我根本没有执行任何代码。
有什么我错过了让这个应用程序 Debug模式的东西吗?

请帮忙!

最佳答案

我在不同的设置上遇到了同样的问题。使用 VSCode 和 dotnet sdk 2.2 运行 Windows 10。

我在浏览 gissues 时找到了一些答案 Here .

This one I think fixed my problem

我还注意到,当被要求将调试器附加到进程时,请确保我选择了正确的“c:/projectdir/bin/debug/projectname.dll”。

之后 VSCode 成功命中我的断点。

我希望这有帮助。

关于c# - Visual Studio Code .NET Core 调试器未命中断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53827947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com