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 に答える