I've been trying to track down an obscure bug for weeks. I've finally found out why I can't see what the problem is.
Unfortunately the app I am debugging has a custom control and when ever this issue occurs I've been looking at a really confusing state that I could not see how it got into. It just seems as if some processing had stopped half way through.
Well now I realise that the processing has.
- You see a Debug.Assert() was being thrown.
- This causes an OnPaint event
- During the OnPaint the code is called AGAIN
- Another Debug.Assert fires, but this time it does get exposed to me
Plan B
#if DEBUG
if (_connections.Contains(arrow) == false)
Debugger.Break();
#endif