System.Diagnostics.Debugger.Debug()停止工作 [英] System.Diagnostics.Debugger.Debug() stopped working

查看:402
本文介绍了System.Diagnostics.Debugger.Debug()停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个使用System.Diagnostics.Debugger.Break()方法的程序来允许用户从命令行设置一个断点。这已经好几个星期了。但是,当我今天正在修理单元测试时,我试图使用命令行中的调试开关,它没有起作用。

I'm working on a program which uses the System.Diagnostics.Debugger.Break() method to allow the user to set a breakpoint from the command-line. This has worked fine for many weeks now. However, when I was working on fixing a unit test today, I tried to use the debug switch from the command-line, and it didn't work.

这是什么我已经尝试过:

Here's what I've tried:


  • 我已经确认Debug()方法真的被调用(通过放置一个System.Console.WriteLine ()之后)

  • 我已经确认该版本仍处于调试

  • 我做了一个干净的构建

  • 我重新启动了Product Studio

  • I've confirmed that the Debug() method is really being called (by putting a System.Console.WriteLine() after it)
  • I've confirmed that the build is still in Debug
  • I've done a clean build
  • I've restarted Product Studio

快速的Google搜索没有显示任何内容,API文档.Net没有提到这个功能无法正常执行的任何内容。所以...任何想法?

A quick Google search didn't reveal anything, and the API documentation for .Net doesn't mention anything about this function not performing correctly. So... any ideas?

推荐答案

我终于弄清楚发生了什么。由于某些原因,我的机器上发生了一些变化,所以调用Debugger.Debug还不够(仍然不明白有什么改变)。在任何情况下,我现在可以通过使用以下方法来调试器:

I finally figured out what was happening. For some reason, something changed on my machine so that just calling Debugger.Debug wasn't sufficient anymore (still don't understand what changed). In any case, I can now cause the debugger to come up by using:

if (Debugger.IsAttached == false) Debugger.Launch();

这篇关于System.Diagnostics.Debugger.Debug()停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆