有没有办法来设置在C#中的动态断点? [英] Is there a way to set a dynamic breakpoint in C#?

查看:129
本文介绍了有没有办法来设置在C#中的动态断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在就是怪怪的C#类。每当执行某些动作,这种情况是一个列表失去成员的属性。我不知道为什么它这样做。因此,我希望做的是建立一个Visual Studio的断点,将暂停程序眼前这个值的变化。有条件的断点不会在这种情况下工作,因为我不知道什么是删除该断点。

I have a class in C# that is acting weird. Whenever I perform some action, a property that happens to be a list loses a member. I have no idea why it's doing this. So what I'd like to do is set up a Visual Studio breakpoint that will pause the program the moment this value changes. A conditional breakpoint would not work in this scenario, since I have no idea what is removing this breakpoint.

要换句话说,我希望我的程序停止的那一刻myList.Count计算为一个新号码。

To put it another way, I want my program to stop the moment myList.Count evaluates to a new number.

这是如何做到这一点任何想法?谢谢!

Any ideas on how to do this? Thanks!

推荐答案

这是不是在C#或任何其他.NET语言的可能的,因为CLR限制。 Visual Studio的原生代码调试器支持C ++代码的数据断点(链接),它做的正是这一点,但这是不支持托管代码。你可以尝试或拦截添加突破删除方法上的建议在对方回答这个集合调用问题。

This is not possible in C# or any of the other .NET languages due to CLR limitations. The Visual Studio native code debugger supports data breakpoints (link) for C++ code which do exactly this but this is not supported for managed code. You could try to break on or intercept Add and Remove method calls on the collection as suggested in the other answer to this question.

这篇关于有没有办法来设置在C#中的动态断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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