Sometimes when I set a breakpoint and start debugging its color changes from red to olive:
When it happens debugging doesn't stop at all - breakpoint is ignored.
I want to know why this happens and how to avoid it in the future.
Edit:
It does not happens only when breakpoint is set on comment开发者_开发技巧ed line of code:
It's open source. Downloading it and finding the relevant code took me about 5 minutes:
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));
}
}
}
}
}
That circle color is "Color.Olive". If you want to know why isHealthy
is false, use the source. There's a couple of reasons I could find quickly: the source file has changed or the module isn't loaded, There may be more.
This occurs if you compile the programm as "release".
Your line is commented where the breakpoint is set.
精彩评论