Following is my problem: I have a custom UserControl in my Windows Forms Project. I can design it in the designer just fine. But as soon as i want to edit the form which contains the control Visual Studio 2010 crashes.
As far as i could see the Constructor and the Load-Event of the control are executed on loading the form.
I tried using another instance of VS2010 to debug the designer, but could not find the location where the execption occurs.
At first my problem seemed to be, that for the Threading.Timer
object, which i use for the initialisation of my Objects (i.e. Loading values from a Database and so on (on error try again later approach ;))), the Callback-Function was executed by the designer an therefore it attempted to access objects to which it had no access while in the design mode.
The initialisation of the Threading.Timer
Object is in the Load-Event. But even after i commented everything in the load event out (except a try catch block an a Debugger.Break()
Call for having a breakpoint in the second instance VS2010 to debug the designer) Visual Studio keeps crashing as soon as I want to edit the form containing the control in design mode.
I tried some steps I found here without an answer to my problem: User control always crashes Visual Studio
So even if the designer has nothing to do when parsing the Load-Event or the Constructor. It still crashes.
Has someone an idea what I could do to prevent Visual Studio from crashing and displaying the user control properly in the forms designer?
The project containing the usercontrol also references some custom libraries and a library project. I don't know if the problem could have something to do with that.