Looking a the SF maskedtexbox class, when the mask is not set the MaskTextProvider is set to nothing and causes the unhandled exception when trying to set the renderText variable in the OnPaint method.