2

有时当我设置断点并开始调试它的颜色从红色变为橄榄色时:

黄色子弹

当它发生时,调试根本不会停止 - 断点被忽略。

我想知道为什么会发生这种情况以及将来如何避免这种情况。

编辑:

只有在注释的代码行上设置断点时才会发生这种情况:

未评论橄榄子弹

4

3 回答 3

3

它是开源的。下载它并找到相关代码花了我大约 5 分钟:

   public void DrawBreakpoint(Graphics g, int y, bool isEnabled, bool isHealthy)
    {
        int diameter = Math.Min(iconBarWidth - 2, textArea.TextView.FontHeight);
        Rectangle rect = new Rectangle(1,
                                       y + (textArea.TextView.FontHeight -
                                                           diameter) / 2,
                                       diameter,
                                       diameter);


        using (GraphicsPath path = new GraphicsPath()) {
            path.AddEllipse(rect);
            using (PathGradientBrush pthGrBrush = new PathGradientBrush(path)) {
                pthGrBrush.CenterPoint = new PointF(rect.Left + rect.Width / 3 , 
                                            rect.Top + rect.Height / 3);
                pthGrBrush.CenterColor = Color.MistyRose;
                Color[] colors = {isHealthy ? Color.Firebrick : Color.Olive};
                pthGrBrush.SurroundColors = colors;

                if (isEnabled) {
                    g.FillEllipse(pthGrBrush, rect);
                } else {
                    g.FillEllipse(SystemBrushes.Control, rect);
                    using (Pen pen = new Pen(pthGrBrush)) {
                        g.DrawEllipse(pen, new Rectangle(rect.X + 1, rect.Y + 1, 
                                                         rect.Width - 2, 
                                                         rect.Height - 2));
                    }
                }
            }
        }
    }

那个圆圈颜色是“Color.Olive”。如果您想知道为什么isHealthy是错误的,请使用源代码。我可以很快找到几个原因:源文件已更改或模块未加载,可能还有更多。

于 2010-03-09T14:52:05.690 回答
2

如果您将程序编译为“发布”,则会发生这种情况。

于 2013-10-02T11:52:12.567 回答
1

您的行在设置断点的位置被注释。

于 2010-03-09T13:48:34.767 回答