您的应用已进入中断状态,但当前没有代码正在执行所选调试引擎支持

时间:2018-02-28 10:35:08

标签: powershell debugging visual-studio-2017

简单地说。我有一个非常简单的类用于测试目的。我试图从Powershell内部调试它,它应该调用Visual Studio 2017调试器。

类别:

namespace ClassLibrary1
{
    public class Class1
    {
        public static void MyMethod()
        {
            Console.WriteLine("method called successfully");
        }

        public static void SecondMethod()
        {
            Console.WriteLine("second method called successfully");
        }

        public void ThirdMethod()
        {
            Console.WriteLine("this method is instantiated");
        }
    }
}

在Powershell中添加程序集

Add-Type -Path "C:\Users\Administrator\ClassLibrary1\bin\Debug\ClassLibrary1.dll"

然后我将调试器附加到Visual Studio 2017中的Powershell进程。 但是当我在powershell中执行代码时,我在visual studio中得到了这个:

Your app has entered a break state, but no code is currently executing that is supported by the selected debug engine (e.g. only native runtime code is executing).

当我将调试器附加到PS Process时,我在输出窗口中得到它:

The thread 'Pipeline Execution Thread' (0xf68) has exited with code 0 (0x0).
The thread '<No Name>' (0x19c8) has exited with code 0 (0x0).
The thread '<No Name>' (0x255c) has exited with code 0 (0x0).
The thread '<No Name>' (0x2690) has exited with code 0 (0x0).
The thread '<No Name>' (0x2434) has exited with code 0 (0x0).
The thread '<No Name>' (0x20b8) has exited with code 0 (0x0).
The thread '<No Name>' (0x2280) has exited with code 0 (0x0).
The thread '<No Name>' (0x212c) has exited with code 0 (0x0).
The thread '<No Name>' (0x222c) has exited with code 0 (0x0).

当我在PowerShell中执行该方法时,在VS Output窗口中,我得到以下内容:

Exception thrown: 'System.Management.Automation.Host.HostException' in System.Management.Automation.dll
The thread 'Pipeline Execution Thread' (0x2b88) has exited with code 0 (0x0).
Exception thrown: 'System.Management.Automation.PSNotImplementedException' in System.Management.Automation.dll
The thread 'Pipeline Execution Thread' (0x1d48) has exited with code 0 (0x0).
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

点击Continue Execution按钮/链接,Visual Studio和Powershell ISe无响应。

我取消选中&#34; Just My code&#34;。有人能告诉我该怎么做吗?

0 个答案:

没有答案