Throw exception if ProcessEvents isn't called on main thread.