在Visual Studio中删除所有禁用的断点 [英] Remove all disabled breakpoints in Visual Studio

查看:66
本文介绍了在Visual Studio中删除所有禁用的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的版本是Visual Studio 2019,但这对我来说已经是几十年来的问题了.

My version is Visual Studio 2019, but this has been a issue for decades for me.

我通过启用/禁用断点来进行长时间的调试.在短时间内,这将导致数百个不相关的禁用断点.

I have long debugging sessions by enabling/disabling breakpoints. In a short time, this will result in hundreds of irrelevant disabled breakpoints.

断点窗口似乎没有删除所有禁用的断点的选项.它甚至无法在已启用的列上进行排序,因此我可以手动将其删除.

The breakpoint window doesn't seem to have an option to remove all disabled breakpoints. It can't even sort on the enabled column so I can manually delete them en masse.

我目前在网格中的禁用断点处移动点击的方式,这有点烂,因为我将有很多断点屏幕,其中遍布启用行.一个简单的排序就可以使它变成两下单击的动作.

I currently shift click my way through the disabled breakpoints in the grid, which kinda sucks because I'll have many screens of breakpoints with enabled rows peppered throughout it. A simple sort would make this a two click move.

有人有聪明的方法吗?还是在相关断点之间快速切换的更好的调试实践?

Anyone have a clever way to do this? Or perhaps a better debugging practice of quickly switching between relevant breakpoints?

推荐答案

对于我的

You can use the following command (language C#) for my Visual Commander extension to remove all disabled breakpoints:

using EnvDTE;
using EnvDTE80;
using System.Linq;

public class C : VisualCommanderExt.ICommand
{
    public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) 
    {
        DTE.Debugger.Breakpoints.Cast<Breakpoint>().Where(i => !i.Enabled).ToList().ForEach(i => i.Delete());
    }
}

这篇关于在Visual Studio中删除所有禁用的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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