The bug is in TWSDLHTMLPublish.WSILInfo method. It calls CoUninitialize too early so the hidden interface cleanup code inserted by the compiler may touch invalid references because COM has been already terminated.