I just submitted #12596 which provides the correct way to do this.