I had a WinForms application that threw a similar code, and the form would not open at runtime. The error came after a database update. Ended up being a control was still attached to a property that had been removed in the update.