【问题标题】:What olive bullet on breakpoint means in SharpDevelop断点上的橄榄子弹在 SharpDevelop 中意味着什么
【发布时间】:2013-10-02 19:52:12
【问题描述】:

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

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

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

编辑:

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

【问题讨论】:

    标签: c# debugging sharpdevelop


    【解决方案1】:

    它是开源的。下载并找到相关代码花了我大约 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 为假,请使用源代码。我可以很快找到几个原因:源文件已更改或模块未加载,可能还有更多。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

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

        【讨论】:

        • 是的,它被评论了,但我认为不是这样。我已经进行了快速测试和断点注释代码行似乎工作正常 -> imgur.com/ssV1W.png
        猜你喜欢
        • 2011-05-04
        • 2017-12-19
        • 1970-01-01
        • 2020-03-12
        • 2023-03-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多