I am debugging an app that was ported from vb6. It has Application.Doevents littered all over the place which is fine except when I am stepping in the debugger. As soon as I step over an Application.DoEvents() control is transferred to some random area which is expected depending on what is pending in the message pump. How can I elegantly override this method in one place at the application level so it works like this (pseudo code)
protected override void Application.Doevents()
{
if (!Debugger.IsAttached)
Application.Doevents()
}
without putting #ifdef DEBUG's all over the place. thanks
There is no need - or possibility - to override it.
Just create a static class with a static method in it and put the code you want to have inside. Change all calls to Application.DoEvents
to calls to that static method.